Jump to content

Ryno

New Members
  • Posts

    6
  • Joined

  • Last visited

    Never

Posts posted by Ryno

  1. Ive changed the code like this:

    <?php  
    			  
    			  $rs	= mysql_query("SELECT p.id, p.name FROM Products p, Orders o WHERE p.id = o.ordered order by p.name ASC");
    $row	= 0;
    
    while(mysql_fetch_row($rs))
    {
    $id	= mysql_result($rs, $row, "id");
    $name	= mysql_result($rs, $row, "name");
    
    echo "The product called $name has the id $id.<br />";
    ++$row;
    }
    			  
    			  ?>

    But it just displays this

     

    The product called koo has the id 2.

    The product called Test1 has the id 1.

    The product called Test1 has the id 1.

    The product called Test1 has the id 1.

     

    How can I make it display the names of the products selected?

  2. Okay I've Read http://www.phpfreaks.com/forums/index.php/topic,203921.msg923805.html on query's but I'm not sure how to make it work. I have a shopping cart the same as that post but i'm not sure how to do that. I have the ids of the products ordered in Orders->ordered like this 1,3,2,1,3,4 but the name of the products is in Products->name and the id column in that table is ID.

     

    How can i make it select the ID in the products table from the orders table and display the name from the name column?

×
×
  • 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.