nscherneck Posted August 20, 2007 Share Posted August 20, 2007 Whats the simplest way to select a record from a table that has three columns? Thank you. Quote Link to comment Share on other sites More sharing options...
Hybride Posted August 20, 2007 Share Posted August 20, 2007 SELECT record FROM table Is that what you're looking for? Quote Link to comment Share on other sites More sharing options...
nscherneck Posted August 20, 2007 Author Share Posted August 20, 2007 well yes, but how to echo the data that comes from that SQL command. Quote Link to comment Share on other sites More sharing options...
js_280 Posted August 20, 2007 Share Posted August 20, 2007 <?php $con = mysql_connect("database host", "username", "password"); $query = "SELECT col_1, col_2, col_3 FROM table"; $result = mysql_query($query, $con); while($data = mysql_fetch_array($result)) { echo($data['col_1'].' '.$data['col_2'].' '.$data['col_3'].'<br />'); } ?> You'll have to substitute your database login information, column names, and table name of course... Quote Link to comment Share on other sites More sharing options...
nscherneck Posted August 20, 2007 Author Share Posted August 20, 2007 perfect, thank you! 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.