mysql_result-2.php : mysql_result « MySQL Database « PHP






mysql_result-2.php

 
<?php
   ...
   $query = "SELECT productid, name FROM product ORDER BY name";
   $result = mysql_query($query);

   for ($count=0; $count <= mysql_numrows($result); $count++)
   {
      $productid = mysql_result($result, $count, "productid");
      $name = mysql_result($result, $count, "name");
      echo "Product: $name ($productid) <br />";
   }
   ...
?>
  
  








Related examples in the same category

1.mysql_result.php
2.function mysql_result() produces a data set.