Jump to content

[SOLVED] mysql query return range of rows from a certain point


Zaynt

Recommended Posts

I have a database with zip-codes and the city-names that go with those zip-codes. I am making an easy search query into the database, but I can't quite figure out how to solve this problem...In the searchfield the user can choose how many rows to return from a certain point.

 

$startrange = 7300; //this is the value of zipcode where the query will start

$returnrows = 50;  //how many rows to return after that point in total (including the row $strartrange)

$query = "SELECT * FROM zipcodes_and_names WHERE zipcode = $startrange";

 

that query will just return the row with the value of $startrange, but I also want to return the next 49 rows..

Do I have to use several query's to do this? any ideas?

 

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.