As I don't know PHP very well, I've been working through the text "Practical PHP and MySQL: Building 8 Dynamic Web Applications" this weekend. Everything was going well until I began working on the shopping cart application.
Here is the code (which matches the book character-for-character) and the error I receive when loading the page:
The error message it gives me is
I've checked two other sites in the text and, while using slightly different names, the logic for the comparable routine is exactly the same as this one ... so I'm out of ideas.
Any thoughts?
Tnx in advance.
Tom
"My mind is like a steel whatchamacallit ...
Here is the code (which matches the book character-for-character) and the error I receive when loading the page:
Code:
<h1>Product Categories</h1>
<ul>
<?php
$catsql = "SELECT * FROM categories;";
$catres = mysql_query($catsql);
while($catrow = mysql_fetch_assoc($catres))
{
echo "<li><a href='" . $config_basedir . "/products.php?id=" . $catrow['id'] . "'>" . $catrow['name'] . "</a></li>";
}
?>
</ul>
The error message it gives me is
Code:
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in C:\wamp\[URL unfurl="true"]www\shoppingcart\bar.php[/URL] on line 8
I've checked two other sites in the text and, while using slightly different names, the logic for the comparable routine is exactly the same as this one ... so I'm out of ideas.
Any thoughts?
Tnx in advance.
Tom
"My mind is like a steel whatchamacallit ...