parkster2001 Posted September 23, 2004 Share Posted September 23, 2004 Hi all, 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 Cheers Link to comment https://forums.phpfreaks.com/topic/1969-dynamic-limit-for-recordsets/ Share on other sites More sharing options...
jerry187 Posted September 23, 2004 Share Posted September 23, 2004 Myself I always use a mysql statement as much as I can to filter the data. It's a lot more efficient than selecting a whole table and filtering it yourself with php. 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 moving on... then store the result $result = mysql_query($query); then do whatever with the result set Hopefully thats what you were talking about Link to comment https://forums.phpfreaks.com/topic/1969-dynamic-limit-for-recordsets/#findComment-6433 Share on other sites More sharing options...
parkster2001 Posted September 23, 2004 Author Share Posted September 23, 2004 Thanks for the help Ill give that a try and let you know how I get on Link to comment https://forums.phpfreaks.com/topic/1969-dynamic-limit-for-recordsets/#findComment-6437 Share on other sites More sharing options...
parkster2001 Posted September 24, 2004 Author Share Posted September 24, 2004 I finally got it 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 Link to comment https://forums.phpfreaks.com/topic/1969-dynamic-limit-for-recordsets/#findComment-6440 Share on other sites More sharing options...
morpheus.100 Posted September 27, 2004 Share Posted September 27, 2004 LIMIT works, but if you require pagination you will need a more suitable arrangement. Check phpfreaks pagination tutorial to find out more. 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. Link to comment https://forums.phpfreaks.com/topic/1969-dynamic-limit-for-recordsets/#findComment-6457 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.