mysql_fetch_assoc(): 4 error
Hi all,
Hope somebody can help a newbie :D
I am just trying to get a list of records from my db. I am using dreamweaver, and using its built in functions to generate the code, but am getting the following:
Only one record (the first record) is being shown, and I receive the following error on the web page:
Warning: mysql_fetch_assoc(): 4 is not a valid MySQL result resource in C:\xampporig\htdocs\clients\duffs\Untitled-6.php on line 44
Here is my code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
</head>
<body>
<?php require_once('Connections/rightcontent.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_rightcontent, $rightcontent);
$query_Recordset1 = "SELECT * FROM rightcontent ORDER BY galleryid ASC";
$query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);
$Recordset1 = mysql_query($query_limit_Recordset1, $rightcontent) 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;
echo $totalRows_Recordset1;
mysql_free_result($Recordset1);
?>
<table width="100%" border="1" cellspacing="0" cellpadding="2">
<?php do { ?>
<tr>
<td><?php echo $row_Recordset1['galleryid']; ?></td>
<td><?php echo $row_Recordset1['img']; ?></td>
<td><?php echo $row_Recordset1['description']; ?></td>
<td><?php echo $row_Recordset1['list position']; ?></td>
<td><?php echo $row_Recordset1['Title']; ?></td>
</tr>
<?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>
</body>
</html>
I will be very grateful for any help anyone can offer :D
Cheers
|