Msword Posted August 9, 2007 Share Posted August 9, 2007 new problem, this is giving me syntax error. The variables are right, $page == 0. $by == pid. i want it to display 1-25 and i just gives error: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/.marja/msword/draftx.net/test/displaytable.php on line 54 Code: if ($sort == "asc") { $result = mysql_query("SELECT pid, name,location, quest, membonly FROM pdatabase LIMIT '$page', 25 ORDER BY " . $by); } ELSE { $result = mysql_query("SELECT pid, name,location, quest, membonly FROM pdatabase LIMIT '$page', 25 ORDER BY " . $by . " DESC"); } technicly the error is when i'm displaying, but i know that works Code: while($row = mysql_fetch_array($result)) Link to comment https://forums.phpfreaks.com/topic/64015-solved-mysql-limit-problem/ Share on other sites More sharing options...
teng84 Posted August 9, 2007 Share Posted August 9, 2007 first remove the ' ' in this '$page', this is supposedly an INT and try to put a die mysql_error to see the error but i think removing this '' will do Link to comment https://forums.phpfreaks.com/topic/64015-solved-mysql-limit-problem/#findComment-319100 Share on other sites More sharing options...
matto Posted August 9, 2007 Share Posted August 9, 2007 When using limit you should use it like this: SELECT pid, name, location, quest, membonly FROM pdatabase order by pid limit $page, 25 Bascially the limit should be the last part of the SQL statement.... Link to comment https://forums.phpfreaks.com/topic/64015-solved-mysql-limit-problem/#findComment-319101 Share on other sites More sharing options...
teng84 Posted August 9, 2007 Share Posted August 9, 2007 yahhhh 8) 8) Link to comment https://forums.phpfreaks.com/topic/64015-solved-mysql-limit-problem/#findComment-319103 Share on other sites More sharing options...
Msword Posted August 9, 2007 Author Share Posted August 9, 2007 Seems to have worked, thanks again guys Link to comment https://forums.phpfreaks.com/topic/64015-solved-mysql-limit-problem/#findComment-319106 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.