I have the following code that pulls category names out of a database. When they click on them, it pulls the images based on that category. It works if the category name is only one word such as Animal but if it is two words like Sports & Games, I get the following
NewCindys/tshirts.html?category=Sports%20&%20Games
I am really new to PHP & MYSQL. Can someone give me an example on how to fix this?
thanks
<?PHP
$host = "localhost";
$username = "rcalthns"; // MySQL username
$password = "snickers"; // MySQL password
$database = "cindystshirts_com"; // MySQL database
$con = mysql_connect($host, $username, $password);
$query = "SELECT distinct category FROM category, tshirts where category.catID = tshirts.catID";
$result = mysql_db_query($database, $query, $con);
while ($row = mysql_fetch_array($result)) { // fetches catergories from table
print ("<A HREF='tshirts.html?category=$row[category]'>$row[category]</A>\n"); // prints the link
}
?>