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?