MySQL queries - do I need to build a PHP function for this?
Posted: Wed Feb 02, 2005 6:37 am
Hi,
I have a table, and I wish to return (for e.g.) row 1 and row 30 from the table, regardless of the index associated with each. In other words, for a given query, I want to return row 1 and 30 into a couple of variables.
I could do this using PHP and using a while() loop and index counter to retrieve rows 1 and 30 for a given query, however this seems to be a bit of an inefficient way of doing it.
Is it possible to do this using a straight query, for a example using LIMIT (a MySQL function I am finding it very difficult to find any online guide to!?)
Many thanks in advance
Mark
I have a table, and I wish to return (for e.g.) row 1 and row 30 from the table, regardless of the index associated with each. In other words, for a given query, I want to return row 1 and 30 into a couple of variables.
I could do this using PHP and using a while() loop and index counter to retrieve rows 1 and 30 for a given query, however this seems to be a bit of an inefficient way of doing it.
Is it possible to do this using a straight query, for a example using LIMIT (a MySQL function I am finding it very difficult to find any online guide to!?)
Many thanks in advance
Mark