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. Link to comment https://forums.phpfreaks.com/topic/65763-solved-need-to-select-a-record-and-echo/ 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? Link to comment https://forums.phpfreaks.com/topic/65763-solved-need-to-select-a-record-and-echo/#findComment-328526 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. Link to comment https://forums.phpfreaks.com/topic/65763-solved-need-to-select-a-record-and-echo/#findComment-328527 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... Link to comment https://forums.phpfreaks.com/topic/65763-solved-need-to-select-a-record-and-echo/#findComment-328531 Share on other sites More sharing options...
nscherneck Posted August 20, 2007 Author Share Posted August 20, 2007 perfect, thank you! Link to comment https://forums.phpfreaks.com/topic/65763-solved-need-to-select-a-record-and-echo/#findComment-328981 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.