Jump to content


Photo

Displaying Code, LIMIT


  • Please log in to reply
2 replies to this topic

#1 blade_922

blade_922
  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 15 September 2006 - 06:53 PM

K here is my query


$hotmain=mysql_query("select * from mos_content ORDER BY `id` DESC LIMIT 2") or die(mysql_error());
while ($donnee = mysql_fetch_array($hotmain))
{ $title= $donnee['title'];  
 $introtext=$donnee['introtext'];
$author=$donnee['created_by']; 
}

For some reason if i just want to display 2 items like i have done i typed 2 and it doesnt display anything, if i change the limit to 9 then it displays 2.

Is there somethin wrong

#2 blade_922

blade_922
  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 15 September 2006 - 06:59 PM

Disregard this post. I had set the  Order by wrong. it should have been ordered by another field.


#3 craygo

craygo
  • Staff Alumni
  • Advanced Member
  • 1,973 posts
  • LocationRhode Island

Posted 15 September 2006 - 06:59 PM

query looks fine do you get any error????

Only thing I can see it that you are not echoing anything out onto the screen

<?php
$hotmain=mysql_query("select * from mos_content ORDER BY `id` DESC LIMIT 2") or die(mysql_error());
while ($donnee = mysql_fetch_array($hotmain))
{ 
$title= $donnee['title'];  
$introtext=$donnee['introtext'];
$author=$donnee['created_by']; 

echo "$title: $introtext $author<br>";
}
?>

Ray




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users