Ver Mensaje Individual
  #3 (permalink)  
Antiguo 21/02/2008, 10:06
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
Re: Comparador de Id - Comparando tres tablas..

Cita:
Iniciado por GatorV Ver Mensaje
Pues si ya tienes en tu tabla productos el id_categoria y el id_marca solo seleccionas por decir los registros donde id_categoria sea igual a la categoría que estas listando y la id_marca sea igual a la marca que hiciste click.

Saludos.
ok fijate.... ya saque conclusiones y bueno la idea es q compare el Id_marca de la tabla producto con la id de la tabla marca...
pues las marcas se repiten por categorias pero con id diferentes...

tons hago esto..

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['id'])) {
  
$colname_Recordset1 $_GET['id'];
}
mysql_select_db($database_connect$connect);
$query_Recordset1 sprintf("SELECT * FROM marca WHERE id = %s"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_select_db($database_connect$connect);
$query_Recordset2 "SELECT * FROM productos WHERE Id_marca =".$row_Recordset1['id'];
$Recordset2 mysql_query($query_Recordset2$connect) or die(mysql_error());
$row_Recordset2 mysql_fetch_assoc($Recordset2);
$totalRows_Recordset2 mysql_num_rows($Recordset2);



?>
<table width="85" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="100"><a href="#" onclick="window.open('verimagen.php?pro_id=<?=$pro_id;?>;','verimagen', 'width=400,height=400'); return false;"><img src="images2/<?php echo $row_Recordset2['imagen']; ?>" width="100" height="100" border="0" class="bordeimg" /></a></td>
    <td width="75%">&nbsp;</td>
  </tr>
</table>
<?php
mysql_free_result
($Recordset1);

mysql_free_result($Recordset2);
?>
pero me sigue arrastrando el id incorrecto!!!!
__________________
Diseño gráfico, Web, imagen corporativa, publicidad ...