I'm trying to split results into different pages and number the pages accordingly. I'm using PHP and accessing a MsSQL database. I've been able to build a fairly intelligent page numbering system which knows which rows it should pull (at least by numbering each row numerically) but I don't know how to construct a SQL query to pull 10 results starting at a certain number. I know MySQL has a function called offset. This combined with the limit function would be great! But MsSQL doesn't seem to work in the same way. Here's what I have so far:
SELECT count(id) FROM members WHERE bla bla bla then load that into a variable called $total. SELECT TOP 10 * FROM members WHERE bla bla bla TOP is the function to only pull a certain number of records. (I had to figure that out the hard way!) I was thinking of possibly making the WHERE statement like WHERE id >= $start AND id <= $start + 10 But that only works if my indexes are consistant. Which they aren't! As I see it, I either need to reindex the table, find a function in MsSQL that works, or pull everything into a big PHP array and try to sort it out there. Any hints or suggestions would be greatly appreciated!!! Thanks, Dean -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php