paulman888888 Posted June 2, 2008 Share Posted June 2, 2008 Is there a way to echo out all the data in a mysql table? Thankyou Quote Link to comment Share on other sites More sharing options...
dezkit Posted June 2, 2008 Share Posted June 2, 2008 yes Quote Link to comment Share on other sites More sharing options...
paulman888888 Posted June 2, 2008 Author Share Posted June 2, 2008 and can you tell me please? Quote Link to comment Share on other sites More sharing options...
dezkit Posted June 2, 2008 Share Posted June 2, 2008 <?php mysql_connect("localhost", "", "") or die(mysql_error()); $query = "SELECT * FROM example"; $result = mysql_query($query) or die(mysql_error()); while($row = mysql_fetch_array($result)){ echo $row['table_name']; echo "<br>"; } ?> lol Quote Link to comment Share on other sites More sharing options...
discomatt Posted June 2, 2008 Share Posted June 2, 2008 $q = 'SELECT * FROM `table`'; $r = mysql_query($q); while ( $row = mysql_fetch_assoc( $r ) ) echo implode( ', ', $row ) . '<br />'; Check manual next time please. Plenty of basic questions are answered with examples shown. Quote Link to comment Share on other sites More sharing options...
rhodesa Posted June 2, 2008 Share Posted June 2, 2008 as an html table: $result = mysql_query("SELECT * FROM tablename"); print '<table>'; while($row = mysql_fetch_assoc($result)){ print '<tr><td>'.implode('</td><td>',$row).'</td></tr>'; } print '</table>'; Quote Link to comment Share on other sites More sharing options...
paulman888888 Posted June 2, 2008 Author Share Posted June 2, 2008 thankyou Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.