rofl90 Posted February 20, 2008 Share Posted February 20, 2008 Heres my code <?php $host = 'xx'; $user = 'xx'; $pass = 'xx'; $db = 'xx'; mysql_connect($host, $user, $pass) or die(mysql_error()); mysql_select_db($db); $info = mysql_query("SELECT * FROM support;"); $i = mysql_fetch_object($info); echo "<table border='1'>"; echo "<tr> <th>Name</th> <th>Email</th> <th>Reason</th> <th>Message</th> </tr>"; // keeps getting the next row until there are no more to get // Print out the contents of each row into a table echo "<tr><td>"; echo $i->name; echo "</td><td>"; echo $i->email; echo "</td><td>"; echo $i->reason; echo "</td><td>"; echo $i->message; echo "</td></tr>"; } echo "</table>"; mysql_close() ?> Quote Link to comment Share on other sites More sharing options...
cyrixware Posted February 20, 2008 Share Posted February 20, 2008 $info = mysql_query("SELECT * FROM support"); or ex.. $SearchResult=mysql_query("SELECT * FROM support ORDER BY yourfield") or die(mysql_error()); Quote Link to comment Share on other sites More sharing options...
akitchin Posted February 20, 2008 Share Posted February 20, 2008 the issue is that you must loop through the results: while ($i = mysql_fetch_object($info)) { // row echoing stuff here } the resource returns a resultset that requires a loop to go through. when you only use one call of mysql_fetch_object(), it'll just grab the row the resultset is pointing to. Quote Link to comment Share on other sites More sharing options...
rofl90 Posted February 20, 2008 Author Share Posted February 20, 2008 got it just a second ago, thx anyway )) 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.