CincoPistolero Posted March 15, 2008 Share Posted March 15, 2008 I need to just pull data from one row in a table. Below is the code I use for the SQL. $query_au = "SELECT * FROM about WHERE active=1 ORDER BY aboutID"; $result_au = mysql_query($query_au) or die ("Error in query: $query_au. " . mysql_error()); $row = mysql_fetch_row($result_au); And here is how I try to display it. Unfortunately, it is not displaying anything. Any help is appreciated. <?php echo "$body"; ?> Quote Link to comment Share on other sites More sharing options...
peranha Posted March 15, 2008 Share Posted March 15, 2008 you need to do <?php echo $row['rowname']; ?> Quote Link to comment Share on other sites More sharing options...
CincoPistolero Posted March 15, 2008 Author Share Posted March 15, 2008 I've tried that and its not working either. Is there an issue with my db call? Quote Link to comment Share on other sites More sharing options...
peranha Posted March 15, 2008 Share Posted March 15, 2008 Here is my code, you can try it, it works on my site. I just put a while statement in there and if no results, it says there is none. while($row = mysql_fetch_row($result)) { ?> <?php echo $row[0];?> <?php } } else { // no // print status message echo "<b class=red>"; echo "No rows found!"; echo "</b>"; } Quote Link to comment Share on other sites More sharing options...
phpSensei Posted March 15, 2008 Share Posted March 15, 2008 Forgot single quotes, and DESC or ASC for the Order By try <?php $query_au = "SELECT * FROM about WHERE `active` = '1' ORDER BY `aboutID` DESC"; $result_au = mysql_query($query_au) or die (mysql_error()); $row = mysql_fetch_assoc($result_au); echo $row['row_1']; ?> 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.