Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

getting mysql data

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
How do i get the data from each row from a table and display it on my php script?
 
<?php
$db = mysql_connect(&quot;host&quot;, &quot;user&quot;, &quot;pasword&quot;);
mysql_select_db(&quot;database&quot;);

$sql = &quot;select col1, col2, col3 from table&quot;;
$res = mysql_query($sql);

echo &quot;<table>\n&quot;;

while ($row = mysql_fetch_array) {
echo &quot;<tr>&quot;;
echo &quot;<td>&quot; . $row['col1'] . &quot;</td>&quot;;
echo &quot;<td>&quot; . $row['col2'] . &quot;</td>&quot;;
echo &quot;<td>&quot; . $row['col3'] . &quot;</td>&quot;;
echo &quot;</tr>\n&quot;;
}
echo &quot;</table>&quot;;
?>

Just hacked away, its 6 am localtime and im a bit dizzy :) cu, Sascha
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top