PHPiSean Posted August 11, 2011 Share Posted August 11, 2011 Here's my code <?php session_start(); ?> <head> <link rel="stylesheet" href="includes/css/style.css" type="text/css"/> <link rel='stylesheet' href='includes/css/reset.css' type="textcss"/> <title>TestStore</title> </head> <?php require('db.inc.php'); $sql = mysql_query("select * from top_links where id > '1'"); echo "<ul>"; echo "<li><a href='http://test.net'>Test</li>"; while(mysql_fetch_array($sql)) { $s_name = $sql['name']; $s_link = $sql['url']; echo "<li><a href='$s_link'>$s_name</a></li>"; } echo "</ul>"; ?> It returns the "Test" I defined, but the query will only returned the bullet points, but not the text nor the url. I looked at my table configuration everything looks right. The column names were "id", "url", and "name". Thanks for the help! Link to comment https://forums.phpfreaks.com/topic/244474-problem-with-returning-values-from-db/ Share on other sites More sharing options...
MasterACE14 Posted August 11, 2011 Share Posted August 11, 2011 this... while(mysql_fetch_array($sql)) { should be this... while($sql = mysql_fetch_array($sql)) { Link to comment https://forums.phpfreaks.com/topic/244474-problem-with-returning-values-from-db/#findComment-1255706 Share on other sites More sharing options...
PHPiSean Posted August 11, 2011 Author Share Posted August 11, 2011 Thanks! solved Link to comment https://forums.phpfreaks.com/topic/244474-problem-with-returning-values-from-db/#findComment-1255708 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.