Displaying information

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
InnerShadow
Forum Commoner
Posts: 37
Joined: Thu Nov 10, 2005 10:44 pm
Location: US

Displaying information

Post by InnerShadow »

I was wondering what the exact syntax for selecting information from a database and then displaying that? Any help would be great.
User avatar
Burrito
Spockulator
Posts: 4715
Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah

Post by Burrito »

Code: Select all

$result = mysql_query("select * from myTable")
  or die(mysql_error());
while($row = mysql_fetch_assoc($result))
{
  echo $row['somefieldfromtable'];
}
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

mysql_connect(), mysql_select_db, mysql_query(), mysql_fetch_assoc()

This documentation should get you started
Post Reply