MySQL

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
lldcrb328
Forum Newbie
Posts: 3
Joined: Wed Feb 04, 2009 3:33 pm

MySQL

Post 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.
User avatar
Ziq
Forum Contributor
Posts: 194
Joined: Mon Aug 25, 2008 12:43 am
Location: Russia, Voronezh

Re: MySQL

Post by Ziq »

You should read a manual first.
Mysql functions list
mysql_fetch_assaoc()
User avatar
Skoalbasher
Forum Contributor
Posts: 147
Joined: Thu Feb 07, 2008 8:09 pm

Re: MySQL

Post 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.
Post Reply