haciendo unas consultas para un listado de productos, me encuentro con este error
Warning: mysql_fetch_assoc(): 8 is not a valid MySQL result resource in /home/indexa/public_html/proyectos/milazzo/productos.php on line 154
cosa q me extraña, ocupo dreamweaver para esta consulta pero de igual manera no veo error alguno, podrian ayudarme a encontrar el errror?.. ya he estado dos dias revisando y d verdad no topo con el error..
Código PHP:
<?php
//conexion inicial
require_once('Connections/cersol.php');
include('conect.php');
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
//extraer variable
$colname_Recordset1 = "1";
if (isset($_GET['id'])) {
$colname_Recordset1 = (get_magic_quotes_gpc()) ? $_GET['id'] : addslashes($_GET['id']);
}
$currentPage = $_SERVER["PHP_SELF"];
$maxRows_Recordset1 = 15;
$pageNum_Recordset1 = 0;
if (isset($_GET['pageNum_Recordset1'])) {
$pageNum_Recordset1 = $_GET['pageNum_Recordset1'];
}
$startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1;
// primera consulta
mysql_select_db($database_cersol, $cersol);
$query_Recordset1 = sprintf("SELECT * FROM productos WHERE id_cat = %s ORDER BY nombre ASC", $colname_Recordset1);
$query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);
$Recordset1 = mysql_query($query_limit_Recordset1, $cersol) or die(mysql_error().' : '.$query_Recordset1);
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($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;
$queryString_Recordset1 = "";
if (!empty($_SERVER['QUERY_STRING'])) {
$params = explode("&", $_SERVER['QUERY_STRING']);
$newParams = array();
foreach ($params as $param) {
if (stristr($param, "pageNum_Recordset1") == false &&
stristr($param, "totalRows_Recordset1") == false) {
array_push($newParams, $param);
}
}
if (count($newParams) != 0) {
$queryString_Recordset1 = "&" . htmlentities(implode("&", $newParams));
}
}
function escala($url,$base){
$datos = GetImageSize($url) OR die("Imagen no válida");
if ($datos[0]>$datos[1]){
$xp = $datos[0]/$base;
$yp = $datos[1]/$xp;
echo '<img src="'.$url.'" width="'.$base.'" height="'.$yp.'" border="0"/>';}
else{
$yp = $datos[1]/$base;
$xp = $datos[0]/$yp;
echo '<img src="'.$url.'" width="'.$xp.'" height="'.$base.'" border="0"/>';}
}
?>