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

Store query result in an Object in php

Sun Oct 26, 2008 8:01 pm

Store query results in an object in php
Code:

<?php

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

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

   while (
$row mysql_fetch_object($result)) {
      
$name $row->firstName;
      
$id $row->id;
      echo 
"Product: $name ($id) <br />";
   }

?>




Post a reply
  Related Posts  to : Store query result in an Object in php
 paging JPA Query result     -  
 loop to read all query result in php     -  
 program using structure to store roll number,name     -  
 How To Store Date Dynamically as a field in mysql using JSP     -  
 EJB-QL IN where query     -  
 using parameter with name query     -  
 update query example     -  
 Query about jsp and printer     -  
 Run query and search from ASP     -  
 more than one parameter with name query     -  

Topic Tags

PHP Database