Page 1 of 1

MySQL

Posted: Wed Feb 04, 2009 3:38 pm
by lldcrb328
Hello everyone,

can someone tell me how can I output all fields of a row in a mysql db using php? and then write.

Re: MySQL

Posted: Wed Feb 04, 2009 3:45 pm
by Ziq
You should read a manual first.
Mysql functions list
mysql_fetch_assaoc()

Re: MySQL

Posted: Wed Feb 04, 2009 3:46 pm
by Skoalbasher

Code: Select all

 
$query = "SELECT * FROM db_name";
$result = mysql_query($query);
 
while($row = mysql_fetch_array($result))
{
   echo $row['username']."<br>";
   echo $row['birthday']."<br>";
}
 
That just pulls from the DB and echos some columns from the DB. You can echo whatever columns you want. Or just do a loop for each $row that is pulled and print everything in it to the screen.