Jump to content

no data is being pulled from database


woodplease

Recommended Posts

I've recently re-uploaded a website i created last year. when it was last online, everything worked perfectly, but now i'm finding that some of my pages that are supposed to retrieve data from a table are not returning anything. i havnt changed any code, and i have confirmed that there is data in the table. my c ode is as follows

 

<?php
$news=mysql_query("SELECT * FROM news ORDER BY date DESC") or die ("Unable to load latest site news");
$numofrows = mysql_num_rows($news);
	echo $numofrows;
for($t = 1; $t<$numofrows; $t++){
	$latest= mysql_fetch_array($news);
	$news_date = date("Y-m-d",$latest['date']);
	echo"<div class='rightLinks'>".$news_date."</div>";
	echo $latest['article_title']."</h2><p>".$latest['article_text'];
	}
?>

i've added the "echo $numofrows" just to check that it is getting something from the database, and the correct number of rows is displayed. if anyone can see any problems, any help would be greatly appreciated

 

thanks

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.