This is driving me crazy. I am trying to tech myself PHP and MySQL and have been doing Ok for only messing with it for a week, but for the last four days I have been trying to figure out what I am doing wrong.
I have a small inventory program I am making. I have two tables:
site_products and site_catagory
I am trying to make a drop down box with the categories listed, which are pulled from the site_catagory table, and onchange I would like the records containing that particular category shown.
Something is blowing up with my query (I think) but I am too much of a newbie to understand why. Would someone mind taking a look and seeing what the malfunction is?
Here is the page where I make the Menu, I named it test.php:
Select Catagory <?php mysql_connect('localhost','hesk','hesk'); mysql_select_db('inv'); $query=("SELECT * FROM site_catagory order by catagory_name ASC"); $result=mysql_query($query); while(list($id, $name)=mysql_fetch_row($result)) { echo "".$name.""; } ?>And here is the page where it’s supposed to grab the records and populate the tables, I named it catagory.php
[php]if (is_numeric($_GET[‘catagory_id’]))
{
mysql_connect(‘localhost’,‘hesk’,‘hesk’);
mysql_select_db(‘inv’);
// $query=“SELECT * FROM site_products where id=$_GET[catagory_id]”;
$query=“SELECT product_id, product_name, product_number, product_count, product_description, product_vendor, product_catagory FROM site_products where id=$_GET[catagory_id]”;
$result=mysql_query($query);
while ($catagory=mysql_fetch_array($result))
{
echo "<table border=“1”>
";
}
}[/php]
If someone can help me figure out what I am doing wrong, I would really appreciate it!!