I have the following implicit join query with the join of two tables on product_id and p.colon it would look as below. Right now the way it is, a warning message is displaying $query1= "select p.id, p.name, p.image, p.colon_id, v.product_id,v.price,v.description,v.image from products p,product_varieties v where p.colon=" .(int) $_GET['menu'] ." AND p.id = v.product_id "; $result = mysql_query($query3, $connection); while ($row4 = mysql_fetch_array($result)) { // line 258 html.... } PHP: But as I said PHP is throwing the following WARNING and Ãt's not letting the data to query and display Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in public_html/example2.php on line 258 Code (markup): Help...[/QUOTE]
Try running your query directly at mysql prompt and see the result whether you aer getting result or not
you can do one thing that is first check if your query is correct or not to this print the query like echo $result then paste this echoed part in sql console of phpmyadmin and chek if your query is right or not
it was a extra field I had in the query, Thank you. I have encounter that it displays three times the row of the same product, Plus prices and varieties of one product is displaying it in different rows as well. What I am trying to aim is the price 20.30 to display in small tray of the first row, then 25.90 display in the medium tray of the first row, and 30.90 display on large tray of the first row. As of displaying as it is now. CREATE TABLE products ( id INT PRIMARY KEY NOT NULL AUTO_INCREMENT, name VARCHAR(255) ); CREATE TABLE product_varieties ( product_id INT, variety VARCHAR(100), price DOUBLE, description TEXT, PRIMARY KEY (product_id, variety) ); INSERT INTO products (id, name) VALUES (1, 'Cotél de camarone'); INSERT INTO product_varieties (product_id, variety, price) VALUES (1, 'Small Tray', 2.9, ); INSERT INTO product_varieties (product_id, variety, price) VALUES (1, 'Medium Tray', 6.9,); INSERT INTO product_varieties (product_id, variety, price) VALUES (1, 'Large Tray', 8.9, ); Code (markup): This is the link http://www.nyhungry.com/example2.php?subject=4&id=2®ister=1&menu=38 What's your take on this.
"select p.id, p.name, p.image, p.colon_id, v.product_id, v.price, v.description, v.image as var_image from products p left join product_varieties v on v.product_id = p.id where p.colon = ".$_GET['menu'] Code (markup):