Thanks, a bunch, dude.
Your tip pointed my nose in the right direction.
It was a very silly mistake which I have been making all afternoon.
I referred to a non existing variable. I changed the name of one that variable and it worked.
However, killing this snake in the grass has directed me to another:
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in c:\program files\Wamp5\www\ownreference\resultsbygenre.php on line 28
<?php
//a link in string format, a flexible way to put a link on the whole site $link="<br><br><a href='searchbygenre.html'>Go back to the search page</a>";
//trial and error shows that the next function must be included to carry the string $name=$_POST['genre']; echo $_POST['genre'];
//this if statement to echo error message when no input is given
if(!$name){
echo "No search term given.";
echo $link;
exit;
}
//this is the connection to the database
$db = mysql_connect("localhost:3306", "root", "0058AARS"); mysql_select_db("vinyldealers", $db);
$query = "SELECT shops.name, shops.phone, shops.email, shops.website FROM shops INNER JOIN shopsgenres ON shops.shopID = shopgenres.shopID WHERE shopgenres.genreID=".$genre;
$result = mysql_query($query);
//this is the error message when there are no matching results
if (mysql_num_rows($result) == 0){
echo "Sorry, mofo, there are no matching results.";
echo $link;
exit;
}
//this while loop outputs the selected tables while ($record=mysql_fetch_assoc($result)){
while (list($fieldname, $fieldvalue) = each ($record)){
echo $fieldname.":<b>".$fieldvalue."</b><br>";
}
echo "<br>";
}
//again a link to go back to the first page
echo $link
?>
This is the code.
I hope you can help me and that I'm not asking too much.
My first week of self-study, you see...