chriscloyd Posted January 27, 2007 Share Posted January 27, 2007 heres my error[quote]Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/srxstud/public_html/test22/includes/liveprojects.php on line 7[/quote]heres my code[code]<?php$get_num_project = mysql_query("SELECT * FROM projects WHERE status = 'Completed'");$num_project = mysql_num_rows($get_num_project);$maxlimit = rand(1,$num_project);$minlimit = $maxlimit - 5;$project_get = mysql_query("SELECT * FROM projects WHERE status = 'Completed' LIMIT '$minlimit','$maxlimit'");while ($p = mysql_fetch_assoc($project_get)) { echo '<table width="95%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="85%">'.$p['title'].'</td> <td align="center" width="15%"><a href=portfolio.php?project='.$p['id'].'">View</a></td> </tr> </table>';}?>[/code] Quote Link to comment Share on other sites More sharing options...
Orio Posted January 27, 2007 Share Posted January 27, 2007 It may be that $minlimit is negative and that's why there's an error.Try:[code]$minlimit = (($maxlimit - 5) > 0) ? $maxlimit - 5 : 0;[/code]Orio. Quote Link to comment Share on other sites More sharing options...
chriscloyd Posted January 31, 2007 Author Share Posted January 31, 2007 i tried that it didnt work Quote Link to comment Share on other sites More sharing options...
Jessica Posted January 31, 2007 Share Posted January 31, 2007 $project_get = mysql_query("SELECT * FROM projects WHERE status = 'Completed' LIMIT '$minlimit','$maxlimit'") OR die(mysql_error()); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.