Ver Mensaje Individual
  #1 (permalink)  
Antiguo 25/01/2008, 09:38
Avatar de T4ke0veR
T4ke0veR
 
Fecha de Ingreso: agosto-2007
Ubicación: Quito - Ecuador
Mensajes: 1.720
Antigüedad: 16 años, 8 meses
Puntos: 28
Exclamación mysql_fetch_assoc():

Saludos señores,

ando diseñando un nuevo sistemita y tengo un problema al marcar la region repetida o hacer el while sale lo siguiente
sale el primer articulo q contiene la base de datos seguido de esta nota

Warning: mysql_fetch_assoc(): 4 is not a valid MySQL result resource in C:\wamp\www\Cersol\HTML\prueba.php on line 57

aqui les dejo mi codigo para ver si alguien podria hecharme una manito...
Saludos y gracias!!

Código PHP:
<?php require_once('Connections/connect.php'); ?>
<?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;
}
}

$colname_Recordset1 "-1";
if (isset(
$_GET['cat_id'])) {
  
$colname_Recordset1 $_GET['cat_id'];
}
mysql_select_db($database_connect$connect);
$query_Recordset1 sprintf("SELECT * FROM marca WHERE cat_id = %s ORDER BY marca_id ASC"GetSQLValueString($colname_Recordset1"int"));
$Recordset1 mysql_query($query_Recordset1$connect) or die(mysql_error());
$row_Recordset1 mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 mysql_num_rows($Recordset1);

mysql_free_result($Recordset1);
?>
<?php 
do { ?>
  <table width="500" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr>
      <td><img src="images/<?php echo $row_Recordset1['imagen']; ?>" width="130" height="130" border="0" class="bordeimg" /></td>
    </tr>
    
    <tr>
      <td><?php echo $row_Recordset1['nombre']; ?></td>
    </tr>
    <tr>
      <td>&nbsp;</td>
    </tr>
      </table>
  <?php } while ($row_Recordset1 mysql_fetch_assoc($Recordset1)); ?>