johnowen Posted July 12, 2009 Share Posted July 12, 2009 Hello, i've been at this for a while but this piece of code won't work. Maybe someone can help me, I know the connection to the database works fine. <?php $query = "SELECT * FROM tracking"; $result = mysql_query($query); echo "ERROR: " . mysql_error(); while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $string = "ID: " . $row['id']; echo $string; } ?> Thanks Link to comment https://forums.phpfreaks.com/topic/165689-displaying-mysql-results/ Share on other sites More sharing options...
ignace Posted July 12, 2009 Share Posted July 12, 2009 echo "ERROR: " . mysql_error(); is always executed, wrap a conditional around it: if (!$result) { echo "ERROR: " . mysql_error(); } Where's the mysql_connect() and mysql_select_db() part? Link to comment https://forums.phpfreaks.com/topic/165689-displaying-mysql-results/#findComment-874000 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.