Store query result in an array : Query Result « MySQL Database « PHP






Store query result in an array

<?php

   mysql_connect("mysql153.secureserver.net","java2s","password");
   mysql_select_db("java2s");

   $query = "SELECT * FROM Employee";
   $result = mysql_query($query);

   while ($row = mysql_fetch_array($result,MYSQL_NUM)) {
      $name = $row[1];
      $developerid = $row[0];
      echo "Product: $name ($developerid) <br />";
   }

?>


           
       








Related examples in the same category

1.Get column alias
2.From result row get the table name
3.Use mysql_result function to get query result
4.Use for loop to read all query result
5.use Column name in select statement as the variable name
6.Store query result in an Object
7.Store query result in an associate array
8.Get returned row count