Dynamic LIMIT for recordsets
Posted 23 September 2004 - 11:58 AM
I'm still very novice when it comes to PHP/mySQL.
Here's what i'm trying to do.....I think the way that DW inserts the code is making it hard for me to figure out myself
I need to somehow limit the output of a recordset using dynamic values - I don't know if it's easier to do this when defining the recordset (using LIMIT) or when ECHOing the results on the page in a different way
Any pointers would be VERY much appreciated
Posted 23 September 2004 - 01:30 PM
just incorporate the values as variables into your query
$query = "SELECT * FROM my_table WHERE this=that LIMIT $row_offset, $rows";OR you can only select certain fields as well
$query = "SELECT column1, column2, column4 FROM my_table WHERE this=that LIMIT $row_offset, $rows";AND you may also skip the offset if you just want the first x rows
then store the result
$result = mysql_query($query);
then do whatever with the result set
Hopefully thats what you were talking about
Posted 23 September 2004 - 07:54 PM
Ill give that a try and let you know how I get on
Posted 24 September 2004 - 11:40 AM
I think the problem had something to do with dreamweaver's variable passed from the URL and my manual variables not working together.
Anyway - all is fixed now. Thanks again
Posted 27 September 2004 - 08:38 AM
As you posted in the Dreamweaver forum I assume you are using dreaweaver. Use the behaviours in the application panel. You can dynamically limit the recors returned from there. F1 launches the manual.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users