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

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.