Hi Evan,

Try something like this instead:

$query = mysql_query("SELECT product_id, product_name, purchase_date from
MyTable ORDER BY product_id  DESC");
if(!$query) {
    echo mysql_errno() . ": " . mysql_error() . "\n";
    die;
} else {
//Now, for fun, display the results in a table with the results linked to a
product information page
   print "<table>";
   while($row=mysql_fetch_array($query)) {
       print "<tr>";
       print "<td><a
href=product_details.php?product_id="$row["product_id"]">" .
$row["product_name"] . " " . $row["purchase_date"] . "</a></td>";
       print "</tr>";
   }
  print "</table>";
}
?>

NOTE: this is not a tested example, and I didn't check it for accuracy.  I
just threw something together to give you some good ideas of where to go
with your code.  I strongly urge you to use the manual (php.net) just to
browse through the available functions.  Good luck!

HTH,
Kirk


"Evan Panagiotopoulos" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I am searching a table and have the following php code with my
> comments:
>
> $result = mysql_query($query);
> print "The result == $result";
> // it returns The result == Resource id #2"
> if (!mysql_fetch_array($result)) {
>  ...
> } else {
>   while ($row = mysql_fetch_array($result)) {
>       ...
>    }
> }
> Neither the if nor the while get executed.
> Can you make any suggestions? Obviously I'm new to this.
>
> Evan

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to