Jump to content

php fetch array


chriscloyd

Recommended Posts

heres my error im getting

Warning: 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 12

heres 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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.