rodhow Posted November 28, 2011 Share Posted November 28, 2011 I am past a beginner in php but no where near an expert and I need some help. This piece of code here: $query .= " limit $s,$limit"; $result = mysql_query($query) or die("Couldn't execute query"); is part of my search results page with paged indexes (next, previous 10, etc.). However with this code i get the die message but if i take the first line off ($query), the page executes but then the page doesn't operate correctly i.e. shows 15 results when the $limit(limit for rows) =10. Is it not written correctly or am I missing somethingwith the top line? if the entire script is needed let me know and i will paste it? Thanks in advance for any help! Link to comment https://forums.phpfreaks.com/topic/251925-this-little-piece-of-code-is-givin-me-fits/ Share on other sites More sharing options...
teynon Posted November 28, 2011 Share Posted November 28, 2011 Change the line to this: $result = mysql_query($query) or die($query."|".mysql_error()); Then post back with the error message. Link to comment https://forums.phpfreaks.com/topic/251925-this-little-piece-of-code-is-givin-me-fits/#findComment-1291708 Share on other sites More sharing options...
rodhow Posted November 28, 2011 Author Share Posted November 28, 2011 Okay I inserted the code and the structure worked properly (ten results on one page, 1 to 10 of 14 results)...good. Thank you very much. However, if I click on the next ten link, it doesn't take me to those last four records, instead it takes me to a fresh page asking for me to submit another search. Im not sure why its doing that but I am grateful to get that part out of the way. Thanks a million! Link to comment https://forums.phpfreaks.com/topic/251925-this-little-piece-of-code-is-givin-me-fits/#findComment-1291710 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.