mysql_fetch_assoc(): 3 is not a valid MySQL result resource
| From: | Ross Hulford | Date: | Sun, 31 Oct 2004 20:32:18 +0000 |
| Subject: | mysql_fetch_assoc(): 3 is not a valid MySQL result resource | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-200778@lists.php.net to get a copy of this message | ||
My page displays the first result and then I get the following
error.................
Warning: mysql_fetch_assoc(): 3 is not a valid MySQL result resource in
c:\inetpub\wwwroot\testy\Untitled-1.php on line 29
Please help.
R.
my code.............
<?php require_once('Connections/ross.php'); ?>
<?php
$maxRows_Recordset1 = 10;
$pageNum_Recordset1 = 0;
if (isset($_GET['pageNum_Recordset1'])) {
$pageNum_Recordset1 = $_GET['pageNum_Recordset1'];
}
$startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1;
mysql_select_db($database_ross, $ross);
$query_Recordset1 = "SELECT portfolio.location_name FROM portfolio";
$query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1,
$startRow_Recordset1, $maxRows_Recordset1);
$Recordset1 = mysql_query($query_limit_Recordset1, $ross) or
die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
if (isset($_GET['totalRows_Recordset1'])) {
$totalRows_Recordset1 = $_GET['totalRows_Recordset1'];
} else {
$all_Recordset1 = mysql_query($query_Recordset1);
$totalRows_Recordset1 = mysql_num_rows($all_Recordset1);
}
$totalPages_Recordset1 = ceil($totalRows_Recordset1/$maxRows_Recordset1)-1;
mysql_free_result($Recordset1);
?>
<?php echo $totalRows_Recordset1 ?>
<?php do { ?>
<p><?php echo $row_Recordset1['location_name']; ?></p>
<?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>