Ver Mensaje Individual
  #1 (permalink)  
Antiguo 08/07/2008, 07:56
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
[ERROR]MySQL server version

Saludos,
Bueno estoy haciendo un sistema donde tngo un menu de categorias, uno de sub categorias y una tabla de productos... ahora bien
El de categorias siempre estará presente...
el de subcategoria solo aparecera si yo doy click en alguna de las categorias
y el producto solo saldra si yo selecciono

de resto al no poseer seleccion en sus campos dira q debe seleccionar un item

aqui les dejo mi codigo y el error que me da

Código PHP:
<?php include('conect.php');

@
$id_sub=$_REQUEST['id_cat'];

@
$id_prod=$_REQUEST['id_sub'];

$sql="SELECT * from categoria ORDER BY nombre ASC";
$sql_exec=mysql_query($sql) or die( "[ERROR] Query: $sql, error: " mysql_error() );
$total mysql_num_rows($sql_exec);

$sql2="SELECT * FROM subcategoria WHERE id_cat = $id_sub ORDER BY nombre ASC";
$sql_exec2=mysql_query($sql2) or die( "[ERROR] Query: $sql2, error: " mysql_error() );

$sql3="SELECT * FROM productos WHERE id_sub = $id_prod";
$sql_exec3=mysql_query($sql3) or die( "[ERROR] Query: $sql3, error: " .mysql_error() );

?> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>

<table width="750" border="0" cellspacing="0" cellpadding="0">
  <tr>

    <td width="250"><table width="250" border="0" cellspacing="0" cellpadding="0">
      <tr><?php if ($total 0) { ?>    <?php while($row=mysql_fetch_assoc($sql_exec)){ ?>
        <td><a href="ficha_cat.php?id_cat=<?php echo $row['id']; ?>"><?php echo $row['nombre']; ?></a>
          </td>
      </tr><?php ?>
          <?php } else {
      echo (
"No hay categorias para mostrar");
?>
    </table></td>
 
  
  <td width="429" valign="top"><table width="250" border="0" cellspacing="0" cellpadding="0">
    <tr><?php
if ($id_sub 0) { ?><?php while($row2=mysql_fetch_assoc($sql_exec2)){ ?>
      <td valign="top">
        
<?php echo $row2['nombre']; ?>        </td>
    </tr><?php ?><?php } else { echo ("Debe seleccionar una categoria"); 
?>
  </table></td>
    <td width="71"><table width="250" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td><table width="300" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <?php
if ($id_prod 0) { ?>
            <?php while($row3=mysql_fetch_assoc($sql_exec3)){ ?>
            <td width="70" rowspan="4">&nbsp;</td>
            <td width="230" align="center"><a href="#" onclick="window.open('verimagen.php?id=<?=$id;?>;','verimagen', 'width=400,height=400'); return false;"><img src="images2/<?php echo $row3['imagen']; ?>" width="200" height="200"  border="0"/></a></td>
          </tr>
          <tr>
            <td><?php echo $row['nombre']; ?></td>
          </tr>
          <tr>
            <td><?php echo $row2['nombre']; ?></td>
          </tr>
          <tr>
            <td><?php echo $row3['descripcion']; ?></td>
          </tr>
          <?php ?>
          <?php } else { echo ("Debe seleccionar una categoria"); 
?>
        </table></td>
      </tr>
    </table></td>
  </tr>
</table>
</body>
</html>
[ERROR] Query: SELECT * FROM subcategoria WHERE id_cat = ORDER BY nombre ASC, error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ORDER BY nombre ASC' at line 1

Gracias una vez mas!!!
__________________
Diseño gráfico, Web, imagen corporativa, publicidad ...