Not a valid MySQL result resource
Posted: Fri Mar 12, 2004 2:40 pm
I got this error on the following page:
Warning: 2 is not a valid MySQL result resource in /home/slacker/saltrivergraphics.com/phptest4.php on line 31
http://saltrivergraphics.com/phptest4.php
I think I might be doing the repeat region wrong, since this is as far as I've gotten so far. Could someone take a look at the code and please tell me where I went wrong. I tried putting a ; at the end of line 2, but that didn't work.
Working w/ DWMX, MAC 10.2.8, databases by myphpadmin through my host. DW seems to be connecting fine.
Steve McIntyre
<?php require_once('Connections/slacker_music.php'); ?>
<?php
$maxRows_rsAll = 15;
$pageNum_rsAll = 0;
if (isset($HTTP_GET_VARS['pageNum_rsAll'])) {
$pageNum_rsAll = $HTTP_GET_VARS['pageNum_rsAll'];
}
$startRow_rsAll = $pageNum_rsAll * $maxRows_rsAll;
mysql_select_db($database_slacker_music, $slacker_music);
$query_rsAll = "SELECT * FROM selections";
$query_limit_rsAll = sprintf("%s LIMIT %d, %d", $query_rsAll, $startRow_rsAll, $maxRows_rsAll);
$rsAll = mysql_query($query_limit_rsAll, $slacker_music) or die(mysql_error());
$row_rsAll = mysql_fetch_assoc($rsAll);
if (isset($HTTP_GET_VARS['totalRows_rsAll'])) {
$totalRows_rsAll = $HTTP_GET_VARS['totalRows_rsAll'];
} else {
$all_rsAll = mysql_query($query_rsAll);
$totalRows_rsAll = mysql_num_rows($all_rsAll);
}
$totalPages_rsAll = ceil($totalRows_rsAll/$maxRows_rsAll)-1;
?>
<p>A List of My Music</p>
<?php do { ?>
<p>
<?php
mysql_free_result($rsAll);
?>
<?php } while ($row_rsAll = mysql_fetch_assoc($rsAll)); ?>
<p>and then some</p>
<p> </p>
Warning: 2 is not a valid MySQL result resource in /home/slacker/saltrivergraphics.com/phptest4.php on line 31
http://saltrivergraphics.com/phptest4.php
I think I might be doing the repeat region wrong, since this is as far as I've gotten so far. Could someone take a look at the code and please tell me where I went wrong. I tried putting a ; at the end of line 2, but that didn't work.
Working w/ DWMX, MAC 10.2.8, databases by myphpadmin through my host. DW seems to be connecting fine.
Steve McIntyre
<?php require_once('Connections/slacker_music.php'); ?>
<?php
$maxRows_rsAll = 15;
$pageNum_rsAll = 0;
if (isset($HTTP_GET_VARS['pageNum_rsAll'])) {
$pageNum_rsAll = $HTTP_GET_VARS['pageNum_rsAll'];
}
$startRow_rsAll = $pageNum_rsAll * $maxRows_rsAll;
mysql_select_db($database_slacker_music, $slacker_music);
$query_rsAll = "SELECT * FROM selections";
$query_limit_rsAll = sprintf("%s LIMIT %d, %d", $query_rsAll, $startRow_rsAll, $maxRows_rsAll);
$rsAll = mysql_query($query_limit_rsAll, $slacker_music) or die(mysql_error());
$row_rsAll = mysql_fetch_assoc($rsAll);
if (isset($HTTP_GET_VARS['totalRows_rsAll'])) {
$totalRows_rsAll = $HTTP_GET_VARS['totalRows_rsAll'];
} else {
$all_rsAll = mysql_query($query_rsAll);
$totalRows_rsAll = mysql_num_rows($all_rsAll);
}
$totalPages_rsAll = ceil($totalRows_rsAll/$maxRows_rsAll)-1;
?>
<p>A List of My Music</p>
<?php do { ?>
<p>
<?php
mysql_free_result($rsAll);
?>
<?php } while ($row_rsAll = mysql_fetch_assoc($rsAll)); ?>
<p>and then some</p>
<p> </p>