chriscloyd Posted January 30, 2007 Share Posted January 30, 2007 heres my error im gettingWarning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\includes\liveprojects.php on line 12heres the code i have[code]<?php$get_num_project = mysql_query("SELECT * FROM projects WHERE status = 'Completed'");$num_project = mysql_num_rows($get_num_project);if ($num_project <= 5) {$maxlimit = 5;$minlimit = 1;} else {$maxlimit = rand(6,$num_project);$minlimit = ($maxlimit - 5);}$project_get = mysql_query("SELECT * FROM projects WHERE status = 'Completed' LIMIT '$minlimit','$maxlimit'");while ($p = mysql_fetch_array($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=protfolio.php?project='.$p['id'].'">View</a></td> </tr> </table>';}?>[/code] Link to comment https://forums.phpfreaks.com/topic/36297-php-fetch-array/ Share on other sites More sharing options...
chronister Posted January 30, 2007 Share Posted January 30, 2007 [code]$project_get = mysql_query("SELECT * FROM projects WHERE status = 'Completed' LIMIT '$minlimit','$maxlimit'") or die(mysql_error());[/code]try that and see if any errors are occuring. I added the or die..... part. Link to comment https://forums.phpfreaks.com/topic/36297-php-fetch-array/#findComment-172599 Share on other sites More sharing options...
chriscloyd Posted January 30, 2007 Author Share Posted January 30, 2007 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''1','2'' at line 1 Link to comment https://forums.phpfreaks.com/topic/36297-php-fetch-array/#findComment-172601 Share on other sites More sharing options...
chronister Posted January 30, 2007 Share Posted January 30, 2007 try this.[code]$project_get = mysql_query("SELECT * FROM projects WHERE status = 'Completed' LIMIT $minlimit,$maxlimit") or die(mysql_error());[/code]No quotes needed around the $minlimit, $maxlimit part Link to comment https://forums.phpfreaks.com/topic/36297-php-fetch-array/#findComment-172609 Share on other sites More sharing options...
tauchai83 Posted January 30, 2007 Share Posted January 30, 2007 it could be the query problem if u got that kind of msg... Link to comment https://forums.phpfreaks.com/topic/36297-php-fetch-array/#findComment-172719 Share on other sites More sharing options...
Orio Posted January 30, 2007 Share Posted January 30, 2007 You already opened a thread with this issue. I asked you try something but you never replied...Read what I told you.http://www.phpfreaks.com/forums/index.php/topic,124308.msg514803.htmlOrio. Link to comment https://forums.phpfreaks.com/topic/36297-php-fetch-array/#findComment-172728 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.