Switch to full style
:read: Start PHP with us. Includes topics to help you in php
Post a reply

loop to read all query result in php

Sun Oct 26, 2008 7:32 pm

Code:
<?php

   mysql_connect
("server","database","password");
   
mysql_select_db("userdb");

   
$query "SELECT id, firstname FROM Employee";
   
$result mysql_query($query);

   for (
$count=0$count <= mysql_numrows($result); $count++) {
      
$id mysql_result($result$count"id");
      
$name mysql_result($result$count"firstname");
      echo 
"$firstname ($id) <br />";
   }

?>




Post a reply
  Related Posts  to : loop to read all query result in php
 paging JPA Query result     -  
 Store query result in an Object in php     -  
 While loop     -  
 do while loop and for loop C++ example help.     -  
 Do while loop     -  
 C++ While loop     -  
 I NEED SOME HELP IN THE FOR LOOP PLZ .. IAM JUST A BEGINNER     -  
 Breaking a Loop     -  
 PIC Assembly For Loop Example     -  
 Using include() Within a Loop     -  

Topic Tags

PHP Database