Monday, 15 August 2011

php - mysql limit not work orderby with limit 0,5 -



php - mysql limit not work orderby with limit 0,5 -

$selectorders=sprintf("select s.stud_rollno, s.admissiondate, s.fname, s.lname, s.gender, c.communityname, t.name, y.yearname, s.iname erp.student s inner bring together year y on year_id = s.ayear inner bring together community c on c.d_id = s.community inner bring together types t on t.id = s.department order s.stud_rollno limit 0,10"); $results = mysql_query($selectorders) or die(mysql_error()); $tot_rsselect = mysql_num_rows($results);

my runtime error you have error in sql syntax; check manual corresponds mysql server version right syntax utilize near 'limit 0, 200' @ line 1

but run in localhost/phpmyadmin page.

i think trying select top 10 rows. in scenario there no need utilize 0, 10 or somthing. can write limit 10

so query be:-

"select s.stud_rollno, s.admissiondate, s.fname, s.lname, s.gender, c.communityname, t.name, y.yearname, s.iname erp.student s inner bring together year y on year_id = s.ayear inner bring together community c on c.d_id = s.community inner bring together types t on t.id = s.department order s.stud_rollno limit 10";

i'm not sure might solution.

php mysql

No comments:

Post a Comment