Solarpitch Posted August 5, 2008 Share Posted August 5, 2008 Hi, I have the below function that will calculate the quantity of specific products in the database and return it but noting will print except for "Product - Quantity: " I ran the query in PHPMYADMIN and it word perfectly so I dont think its an issue with that. <?php function overview($id) { dbconnect(); $sql = "SELECT product_id, SUM(order) FROM orders WHERE id = ".$id." GROUP BY product_id"; $result = mysql_query($sql); while(($row = mysql_fetch_row($result)) != false) { $quantity = $row[5]; $product = $row[8]; $print = "Product ". $product. " - Quantity: ". $row['SUM($quantity)']; $print .= "<br />"; } return $print; } ?> Link to comment https://forums.phpfreaks.com/topic/118250-solved-issue-with-displaying-results-from-a-function/ Share on other sites More sharing options...
Solarpitch Posted August 5, 2008 Author Share Posted August 5, 2008 Sorry... when I looked itno it further I realized I was calling the incorrect row numbers ($row[8] should of been $row[2] etc) Link to comment https://forums.phpfreaks.com/topic/118250-solved-issue-with-displaying-results-from-a-function/#findComment-608550 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.