Anyone have the code?

[size=10pt]There are about 100 rows of data in my MySql database. I am using this line to query them:

[php]$sql = mysql_query(“SELECT * FROM radio ORDER BY id ASC”);[/php]

I would like to know if here is a way for me to specify which row id the query begins at? Like, $go a row id number between 1 and 100.[/size]

you can use the LIMIT word in you sql
for example
[php]$sql = mysql_query(“SELECT * FROM radio ORDER BY id ASC LIMIT 30,20”);[/php]
where 30 means starting from record number 31 and 20 is the amount of record you will fetch from your query

Thats how I would do it.

Yes, everyone is correct. Use a variable such as $start or $go and set it to the starting point.
Then, execute the query using the “LIMIT $start, number of records to read” or just “LIMIT $start” to get all the rest of the records.

ALSO: Please do not use a subject like “Anyone have the code?” ! It does not tell us what you are requesting help with and not everyone can help with limit’s in SQL or MySQL code. It just makes it faster for the right person to help you. Thanks! And, karma-up all those who help you… (not me, i don’t care…)

Sponsor our Newsletter | Privacy Policy | Terms of Service