PDA

View Full Version : PHP mysql_query string problem...



mikebarbaro
05 Apr 2011, 06:33 PM
I have a simple query that I want to use to query the MySQL database and come up with my 5 of my upcoming events that are listed.

I am currently using SELECT * FROM `events` ORDER BY `start_date`, `time` ASC LIMIT 5

For some reason when I take out the LIMIT 5 it works but with the LIMIT 5 it shows nothing.

Any help is appreciated.

awniyya1
05 Apr 2011, 10:53 PM
Hello Friend,
In this query you used "LIMIT" and you have given only 5 alone, so it is not displaying any values. The correct syntax for LIMIT is

LIMIT X , Y ----> Here we have to specify X which is the starting index and Y is the count. For example LIMIT 5, 5 this will display the record from 6th Index to the 10th Index.

Hope this will solve your problem.


Ahamed