your function

 function display_contents($table,$session)
 {
  $count = 0;
  $result = mysql_query( "SELECT * FROM $table WHERE session = '$session'");
  while($row = mysql_fetch_array($result))
  {
   $result_inv = mysql_query( "SELECT * FROM retailseafood WHERE pid = 
'{$row['items']}' ");
   $row_inventory = mysql_fetch_array($result_inv);
   $contents['items'][$count] = $row_inventory['pid'];
   $contents['price'][$count] = $row_inventory['price'];
   $contents['total'][$count] = $row_inventory['price'] * $row['quantity'];
   $count ++;
  }
  $total = $this->cart_total($table, $session);
  $contents['final'] = $total;
  return $contents;
 }

looks ok, there are some code snippits missing ($this->cart_total()) but I'll assume 
its rudamentry. the code you are missing is how your accually calling your function

<a href="cart.php?action=display">View Contents Of Cart</A>

is a url, you forgot to include the src of cart.php to see where you are accually 
calling the function.

cart.php
<?php

    if ($action == 'display')
        display_contents('some_table', $sessionID);

?>

please email me if you have more questions or comments.


-- 

 Chris Lee
 Mediawaveonline.com

 ph. 250.377.1095
 ph. 250.376.2690
 fx. 250.554.1120

 [EMAIL PROTECTED]




"Kurth Bemis" <[EMAIL PROTECTED]> wrote in message 
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
i can't get his function to work.  i pass the correct data to it...but no 
results....

heres the function

function display_contents($table,$session)
{
$count = 0;
$result = mysql_query( "SELECT * FROM $table WHERE session='$session'");
while($row = mysql_fetch_array($result)){
$result_inv = mysql_query( "SELECT * FROM retailseafood WHERE 
pid='$row[items]'");
$row_inventory = mysql_fetch_array($result_inv);
$contents[ "items"][$count] = $row_inventory[pid];
$contents[ "price"][$count] = $row_inventory[price];
//$contents[ "quantity"][$count] = $row[quantity];
$contents[ "total"][$count] = ($row_inventory[price] * $row[quantity]);
$count ++;
}
$total = $this->cart_total($table,$session);
$contents[ "final"] = $total;
return $contents;
}
// return number of items in cart

and heres what i do to call the function

<A href="cart.php?action=display">View Contents Of Cart</A>

what or where am i doing/going wrong?

~kurth


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to