Jump to content

no data is being pulled from database


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


$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



Link to comment
Share on other sites

This thread is more than a year old.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • 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.