Jump to content

[SOLVED] Issue with displaying results from a function?


Solarpitch

Recommended Posts

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;




}

?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.