Jump to content

mysql request suddenly not working properly


cedricganon

Recommended Posts

Hello Everyone

 

So i have this script that pulls some stuff out of a db and displays it. Pretty basic. It used to work fine but now it omits one entry from the table. It always shows one less than its supposed to. I.E. if there are 4 table entries, it only shows 3. It didnt do this before and I'm not sure why it changed. I didnt edit the code at all. Here it is:

 

else{
$sql = "SELECT * FROM article WHERE lang='" . $validlang ."' AND cat_id=" . $validentry
		. " ORDER BY id DESC LIMIT 5";

$result = mysql_query($sql);
if(!$result){
	echo "Error querying the database." . mysql_error();
	exit;
}
else{
	$row = mysql_fetch_assoc($result);
}
if(!$row){
	echo "Error: No articles found." . mysql_error();
	exit;
}
else{		
	echo "<div id='section'>Organization News</div>";
	while($row = mysql_fetch_assoc($result)){
		echo "<h3><a href='" . $validlang . "/" . $row['location'] . "'>" . $row['title'] . "</a></h3>";
		echo "<div id='subtitle'>" . $row['summary'] . "</div>";
	}
}
}	

 

Any help would be appreciated. Thanks

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

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

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