SV: [PHP-WIN] mysql_fetch_assoc(): 3 is not a valid MySQL result resource
| From: | Henrik Hornemann | Date: | Mon, 01 Nov 2004 09:17:13 +0000 |
| Subject: | SV: [PHP-WIN] mysql_fetch_assoc(): 3 is not a valid MySQL result resource | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-24863@lists.php.net to get a copy of this message | ||
Well, you freed $Recordset1 just before yoy entered the loop, so
naturally you cant keep fetching from it.
Regards Henrik Hornemann
-----Oprindelig meddelelse-----
Fra: Ross Hulford [mailto:ross@aztechost.com]
Sendt: 31. oktober 2004 21:29
Til: php-windows@lists.php.net
Emne: [PHP-WIN] mysql_fetch_assoc(): 3 is not a valid MySQL result
resource
This is 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)); ?>
It displays one result then thows up 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
--
PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit:
http://www.php.net/unsub.php