[SOLVED] mysql_fetch_assoc ERROR!! help!
Posted: Thu Mar 31, 2005 1:11 pm
My error...
(the 2nd instance is where the browser says the error is)
Warning: mysql_fetch_assoc(): 3 is not a valid MySQL result resource (line 53)
I know its a simple error, but I'm not that handy with PHP/MySQL.
This is from a tutorial using Dreamweavers server behaviors. None of this is my own code except for simple text and the style sheet call. What are my options?
My code...
(the 2nd instance is where the browser says the error is)
Warning: mysql_fetch_assoc(): 3 is not a valid MySQL result resource (line 53)
I know its a simple error, but I'm not that handy with PHP/MySQL.
This is from a tutorial using Dreamweavers server behaviors. None of this is my own code except for simple text and the style sheet call. What are my options?
My code...
Code: Select all
<?php require_once('../Connections/DB.php'); ?>
<?php
$currentPage = $_SERVER["PHP_SELF"];
$maxRows_BigList = 25;
$pageNum_BigList = 0;
if (isset($_GET['pageNum_BigList'])) {
$pageNum_BigList = $_GET['pageNum_BigList'];
}
$startRow_BigList = $pageNum_BigList * $maxRows_BigList;
mysql_select_db($database_DB, $DB);
$query_BigList = "SELECT MID, Featured, MemberName, MemberNum, ExtColor, Descr1, Descr2, ThreeSiName, ForSale, `State` FROM memberinfo ORDER BY MemberNum ASC";
$query_limit_BigList = sprintf("%s LIMIT %d, %d", $query_BigList, $startRow_BigList, $maxRows_BigList);
$BigList = mysql_query($query_limit_BigList, $DB) or die(mysql_error());
$row_BigList = mysql_fetch_assoc($BigList);
if (isset($_GET['totalRows_BigList'])) {
$totalRows_BigList = $_GET['totalRows_BigList'];
} else {
$all_BigList = mysql_query($query_BigList);
$totalRows_BigList = mysql_num_rows($all_BigList);
}
$totalPages_BigList = ceil($totalRows_BigList/$maxRows_BigList)-1;
$queryString_BigList = "";
if (!empty($_SERVER['QUERY_STRING'])) {
$params = explode("&", $_SERVER['QUERY_STRING']);
$newParams = array();
foreach ($params as $param) {
if (stristr($param, "pageNum_BigList") == false &&
stristr($param, "totalRows_BigList") == false) {
array_push($newParams, $param);
}
}
if (count($newParams) != 0) {
$queryString_BigList = "&" . htmlentities(implode("&", $newParams));
}
}
$queryString_BigList = sprintf("&totalRows_BigList=%d%s", $totalRows_BigList, $queryString_BigList);
?>
<link href="../css/admin.css" rel="stylesheet" type="text/css">
<?php require('menu.php'); ?>
<?php
mysql_free_result($BigList);
?>
<?php if ($totalRows_BigList > 0) { // Show if recordset not empty ?>
<h1>Edit or Delete Existing Cars</h1>
<?php do { ?>
<p><?php echo $row_BigList['Featured']; ?> | <?php echo $row_BigList['MemberName']; ?> | <?php echo $row_BigList['MemberNum']; ?> | <?php echo $row_BigList['ExtColor']; ?> | <a href="edit.php?id=<?php echo $row_BigList['MID']; ?>">EDIT</a> <a href="delete.php?id=<?php echo $row_BigList['MID']; ?>">DELETE</a> </p>
<?php } while ($row_BigList = mysql_fetch_assoc($BigList)); ?>
<p>
<?php if ($pageNum_BigList > 0) { // Show if not first page ?>
<a href="<?php printf("%s?pageNum_BigList=%d%s", $currentPage, max(0, $pageNum_BigList - 1), $queryString_BigList); ?>">PREVIOUS</a>
<?php } // Show if not first page ?>
<?php if ($pageNum_BigList < $totalPages_BigList) { // Show if not last page ?>
<a href="<?php printf("%s?pageNum_BigList=%d%s", $currentPage, min($totalPages_BigList, $pageNum_BigList + 1), $queryString_BigList); ?>">NEXT</a>
<?php } // Show if not last page ?>
</p>
<?php } // Show if recordset not empty ?>
<?php if ($totalRows_BigList == 0) { // Show if recordset empty ?>
<p>There are no records in the database. </p>
<?php } // Show if recordset empty ?>