Foros del Web » Programando para Internet » PHP »

[ERROR]MySQL server version

Estas en el tema de [ERROR]MySQL server version en el foro de PHP en Foros del Web. 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 ...
  #1 (permalink)  
Antiguo 08/07/2008, 07:56
Avatar de 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 ...
  #2 (permalink)  
Antiguo 08/07/2008, 08:05
Avatar de GatorV
$this->role('moderador');
 
Fecha de Ingreso: mayo-2006
Ubicación: /home/ams/
Mensajes: 38.567
Antigüedad: 17 años, 11 meses
Puntos: 2135
Respuesta: [ERROR]MySQL server version

Hola T4ke0veR,

Si te fijas en el query te falta el id_cat en tu clausula where, por eso te marca el error. Debes de comprobar si tu parámetro $_GET['id_sub'] no esta vacío antes de enviar el valor a SQL.

Saludos.
  #3 (permalink)  
Antiguo 08/07/2008, 08:08
Avatar de T4ke0veR  
Fecha de Ingreso: agosto-2007
Ubicación: Quito - Ecuador
Mensajes: 1.720
Antigüedad: 16 años, 8 meses
Puntos: 28
Respuesta: [ERROR]MySQL server version

Código PHP:
$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() ); 
=/
me funcionaba hasta q agregue este quiery
Código PHP:
$sql3="SELECT * FROM productos WHERE id_sub = $id_prod";
$sql_exec3=mysql_query($sql3) or die( "[ERROR] Query: $sql3, error: " .mysql_error() ); 
__________________
Diseño gráfico, Web, imagen corporativa, publicidad ...
  #4 (permalink)  
Antiguo 08/07/2008, 08:09
Avatar de alapaco  
Fecha de Ingreso: septiembre-2003
Ubicación: Caballito - Buenos Aires - Argentina - América del Sur - Planeta Tierra - Sistema Solar - Vía Láctea
Mensajes: 216
Antigüedad: 20 años, 7 meses
Puntos: 5
Respuesta: [ERROR]MySQL server version

Tiene algún valor la variable $id_sub ??
__________________
__________________
Álvaro Lapacó
  #5 (permalink)  
Antiguo 08/07/2008, 08:21
Avatar de T4ke0veR  
Fecha de Ingreso: agosto-2007
Ubicación: Quito - Ecuador
Mensajes: 1.720
Antigüedad: 16 años, 8 meses
Puntos: 28
Respuesta: [ERROR]MySQL server version

viene determinada aqui
Código PHP:
@$id_sub=$_REQUEST['id_cat'];

@
$id_prod=$_REQUEST['id_sub']; 
si el url fuese ficha_cat.php deberia decirme en subcategoria y en productos Debe seleccionar un item...
por eso en donde hago la impresion de datos hago
Código PHP:
<?php
if ($variable 0) { ?>
si el URL es =
ficha_cat.php?id_cat=1 por ejemplo deberian salir categoria y subcategorias
y si fuese ficha_cat.php?id_cat=1&id_sub=2
deberia mostrarme todo
__________________
Diseño gráfico, Web, imagen corporativa, publicidad ...
  #6 (permalink)  
Antiguo 08/07/2008, 08:24
Avatar de alapaco  
Fecha de Ingreso: septiembre-2003
Ubicación: Caballito - Buenos Aires - Argentina - América del Sur - Planeta Tierra - Sistema Solar - Vía Láctea
Mensajes: 216
Antigüedad: 20 años, 7 meses
Puntos: 5
Respuesta: [ERROR]MySQL server version

Está bien, pero si haces:
Código PHP:
echo $id_sub
devuelve algún valor entero ??

Por otra es un tanto extraño que a la variable $id_sub no le asignes $_REQUEST['id_sub'];
__________________
__________________
Álvaro Lapacó
  #7 (permalink)  
Antiguo 08/07/2008, 08:46
Avatar de T4ke0veR  
Fecha de Ingreso: agosto-2007
Ubicación: Quito - Ecuador
Mensajes: 1.720
Antigüedad: 16 años, 8 meses
Puntos: 28
Respuesta: [ERROR]MySQL server version

Código PHP:
<a href="ficha_cat.php?id_cat=<?php echo $row['id']; ?>"><?php echo $row['nombre']; ?></a>
dime donde hago ese echo please!!!
__________________
Diseño gráfico, Web, imagen corporativa, publicidad ...
  #8 (permalink)  
Antiguo 08/07/2008, 09:01
Avatar de alapaco  
Fecha de Ingreso: septiembre-2003
Ubicación: Caballito - Buenos Aires - Argentina - América del Sur - Planeta Tierra - Sistema Solar - Vía Láctea
Mensajes: 216
Antigüedad: 20 años, 7 meses
Puntos: 5
Respuesta: [ERROR]MySQL server version

El echo ponelo debajo de la linea
Código PHP:
@$id_prod=$_REQUEST['id_sub']; 
Es solamente para cerciorarte de que esa variable tenga un valor entero, despues podes borrar esa linea.
__________________
__________________
Álvaro Lapacó
  #9 (permalink)  
Antiguo 08/07/2008, 09:13
Avatar de T4ke0veR  
Fecha de Ingreso: agosto-2007
Ubicación: Quito - Ecuador
Mensajes: 1.720
Antigüedad: 16 años, 8 meses
Puntos: 28
Respuesta: [ERROR]MySQL server version

[ERROR] Query: SELECT * FROM subcategoria WHERE id_cat = ORDER BY nombre ASC, error: echo ; 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
esto es lo q me devuelve...
ahora... id_sub es = al id_cat q viene del url...
__________________
Diseño gráfico, Web, imagen corporativa, publicidad ...
  #10 (permalink)  
Antiguo 08/07/2008, 09:20
Avatar de alapaco  
Fecha de Ingreso: septiembre-2003
Ubicación: Caballito - Buenos Aires - Argentina - América del Sur - Planeta Tierra - Sistema Solar - Vía Láctea
Mensajes: 216
Antigüedad: 20 años, 7 meses
Puntos: 5
Respuesta: [ERROR]MySQL server version

Si, pero llega algo o no ??? Esa es mi pregunta, por eso te dije que escribas ese echo para verificar que llegue bien el dato.

Tambien podes correr ese query desde alguna consola de sql para ver si está bien escrito.
__________________
__________________
Álvaro Lapacó
  #11 (permalink)  
Antiguo 08/07/2008, 09:28
Avatar de T4ke0veR  
Fecha de Ingreso: agosto-2007
Ubicación: Quito - Ecuador
Mensajes: 1.720
Antigüedad: 16 años, 8 meses
Puntos: 28
Respuesta: [ERROR]MySQL server version

alpaco me acabo de dar cuenta d algo
el error es cuando entro a mi pagina sin enviar un id... pero si hago esto

http://localhost/Flamuko/ficha_cat.p...cat=1&id_sub=2

me lo muestra!!!!
no deberia..!!!

quiero q cuando el id este limpio tambien lo haga
__________________
Diseño gráfico, Web, imagen corporativa, publicidad ...
  #12 (permalink)  
Antiguo 08/07/2008, 09:31
Avatar de alapaco  
Fecha de Ingreso: septiembre-2003
Ubicación: Caballito - Buenos Aires - Argentina - América del Sur - Planeta Tierra - Sistema Solar - Vía Láctea
Mensajes: 216
Antigüedad: 20 años, 7 meses
Puntos: 5
Respuesta: [ERROR]MySQL server version

En ese caso tenes que inicializar la(s) variable(s) nada mas, algo así:
Código PHP:
$id_sub = -1
if (isset($_REQUEST['id_cat']))
  
$id_sub $_REQUEST['id_cat']; 
__________________
__________________
Álvaro Lapacó
  #13 (permalink)  
Antiguo 08/07/2008, 12:13
Avatar de T4ke0veR  
Fecha de Ingreso: agosto-2007
Ubicación: Quito - Ecuador
Mensajes: 1.720
Antigüedad: 16 años, 8 meses
Puntos: 28
Respuesta: [ERROR]MySQL server version

mmm me dice
Parse error: syntax error, unexpected T_IF in C:\wamp\www\Flamuko\ficha_cat.php on line 4

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

$id_sub = -
if (isset($_REQUEST['id_cat'])) 
  
$id_sub $_REQUEST['id_cat']; 
  
$id_prod = -
if (isset($_REQUEST['id_sub'])) 
  
$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: echo $id_sub; " mysql_error() );

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

?>
__________________
Diseño gráfico, Web, imagen corporativa, publicidad ...
  #14 (permalink)  
Antiguo 08/07/2008, 12:18
Avatar de alapaco  
Fecha de Ingreso: septiembre-2003
Ubicación: Caballito - Buenos Aires - Argentina - América del Sur - Planeta Tierra - Sistema Solar - Vía Láctea
Mensajes: 216
Antigüedad: 20 años, 7 meses
Puntos: 5
Respuesta: [ERROR]MySQL server version

Falta un punto y com en esta linea "$id_sub = -1 ", me olvidé de ponerlo.
__________________
__________________
Álvaro Lapacó
  #15 (permalink)  
Antiguo 08/07/2008, 12:23
Avatar de T4ke0veR  
Fecha de Ingreso: agosto-2007
Ubicación: Quito - Ecuador
Mensajes: 1.720
Antigüedad: 16 años, 8 meses
Puntos: 28
Respuesta: [ERROR]MySQL server version

perfecto... en efecto faltaba cerrar esa linea...
Código PHP:
$id_sub = -1;
if (isset(
$_REQUEST['id_cat'])) 
  
$id_sub $_REQUEST['id_cat']; 
Gracias brother
__________________
Diseño gráfico, Web, imagen corporativa, publicidad ...
  #16 (permalink)  
Antiguo 08/07/2008, 12:49
Avatar de T4ke0veR  
Fecha de Ingreso: agosto-2007
Ubicación: Quito - Ecuador
Mensajes: 1.720
Antigüedad: 16 años, 8 meses
Puntos: 28
Respuesta: [ERROR]MySQL server version

mmmmm tengo un problema no se si con el URL pero al seleccionar para q me salga el producto... no lo carga!!!!
Código PHP:
<?php include('conect.php');

$id_sub = -1;
if (isset(
$_REQUEST['id_cat'])) 
  
$id_sub $_REQUEST['id_cat']; 
  
$id_prod = -1
if (isset(
$_REQUEST['id_sub'])) 
  
$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: echo $id_sub; " 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">
        
<a href="ficha_cat.php?id_cat=<?php echo $row2['id_cat']; ?>&<?php echo $row2['id_sub']; ?>"><?php echo $row2['nombre']; ?></a>        </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 $row3['nombre']; ?></td>
          </tr>
          <tr>
            <td><?php echo $row3['codigo']; ?></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>
__________________
Diseño gráfico, Web, imagen corporativa, publicidad ...
  #17 (permalink)  
Antiguo 08/07/2008, 13:24
Avatar de T4ke0veR  
Fecha de Ingreso: agosto-2007
Ubicación: Quito - Ecuador
Mensajes: 1.720
Antigüedad: 16 años, 8 meses
Puntos: 28
Fallo en impresion de datos...

Saludos,
yo nuevamente molestandolos... sigo en mi menu multiple.. ya muchos saben que es lo q hago pero de igual menra vuelvo a explicar...
es un menu de categoria que al dar click se genera uno de sub y de ahy se genera un listado de productos pero siempre manteniendo los menu en la misma pagina... todo funciona perfecto.. pero al tener q cargar la lista de productos no me carga nada de nada
les dejo un enlace para q entiendan su funcionamiento
Prueba funcionamiento

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

$id_sub = -1;
if (isset(
$_REQUEST['id_cat'])) 
  
$id_sub $_REQUEST['id_cat']; 
  
$id_prod = -1
if (isset(
$_REQUEST['id_sub'])) 
  
$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: echo $id_sub; " 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">
        
<a href="ficha_cat.php?id_cat=<?php echo $row2['id_cat']; ?>&<?php echo $row2['id_sub']; ?>"><?php echo $row2['nombre']; ?></a>        </td>
    </tr><?php ?><?php } else { echo ("Debe seleccionar una Subcategoria"); 
?>
  </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">&nbsp;</td>
            <td width="230" align="center"><?php echo $row3['nombre']; ?></td>
          </tr>
          
          <?php ?>
          <?php } else { echo ("Debe seleccionar una categoria"); 
?>
        </table></td>
      </tr>
    </table></td>
  </tr>
</table>
</body>
</html>
alguien ve el error???

Gracias y disculpen las molestias
__________________
Diseño gráfico, Web, imagen corporativa, publicidad ...
  #18 (permalink)  
Antiguo 08/07/2008, 13:25
Avatar de alapaco  
Fecha de Ingreso: septiembre-2003
Ubicación: Caballito - Buenos Aires - Argentina - América del Sur - Planeta Tierra - Sistema Solar - Vía Láctea
Mensajes: 216
Antigüedad: 20 años, 7 meses
Puntos: 5
Respuesta: [ERROR]MySQL server version

Y como queda la URL ?
__________________
__________________
Álvaro Lapacó
  #19 (permalink)  
Antiguo 08/07/2008, 13:27
Avatar de T4ke0veR  
Fecha de Ingreso: agosto-2007
Ubicación: Quito - Ecuador
Mensajes: 1.720
Antigüedad: 16 años, 8 meses
Puntos: 28
Respuesta: [ERROR]MySQL server version

fijate aqui
http://indexa.com.ve/flamuko/prueba/ficha_cat.php
__________________
Diseño gráfico, Web, imagen corporativa, publicidad ...
  #20 (permalink)  
Antiguo 08/07/2008, 13:31
Avatar de alapaco  
Fecha de Ingreso: septiembre-2003
Ubicación: Caballito - Buenos Aires - Argentina - América del Sur - Planeta Tierra - Sistema Solar - Vía Láctea
Mensajes: 216
Antigüedad: 20 años, 7 meses
Puntos: 5
Respuesta: [ERROR]MySQL server version

La url queda mal, fijate que en vez de ser
http://indexa.com.ve/flamuko/prueba/...php?id_cat=2&3
debería ser
http://indexa.com.ve/flamuko/prueba/...cat=2&id_sub=3
__________________
__________________
Álvaro Lapacó
  #21 (permalink)  
Antiguo 08/07/2008, 13:52
Avatar de T4ke0veR  
Fecha de Ingreso: agosto-2007
Ubicación: Quito - Ecuador
Mensajes: 1.720
Antigüedad: 16 años, 8 meses
Puntos: 28
Respuesta: [ERROR]MySQL server version

si... pero al agregar el ultimo paso q es donde me muestra la descripcion del producto como tal no me captura los id .. solo el ultimo!!!!
Código PHP:
<?php include('conect.php');

$id_sub = -1;
if (isset(
$_REQUEST['id_cat'])) 
  
$id_sub $_REQUEST['id_cat']; 
  
$id_prod = -1
if (isset(
$_REQUEST['id_sub'])) 
  
$id_prod $_REQUEST['id_sub']; 
  
$id_prod2 = -1
if (isset(
$_REQUEST['id'])) 
  
$id_prod2 $_REQUEST['id']; 

$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() );

$sql4="SELECT * FROM productos WHERE id = $id_prod2";
$sql_exec4=mysql_query($sql4) or die( "[ERROR] Query: $sql4, 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">
        
<a href="ficha_cat.php?id_cat=<?php echo $row2['id_cat']; ?>&id_sub=<?php echo $row2['id_sub']; ?>"><?php echo $row2['nombre']; ?></a>        </td>
    </tr><?php ?><?php } else { echo ("Debe seleccionar una Subcategoria"); 
?>
  </table></td>
    <td width="71"><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">&nbsp;</td>
        <td width="230" align="center"><a href="ficha_cat.php?id_cat=<?php echo $row2['id_cat']; ?>&id_sub=<?php echo $row2['id_sub']; ?>&id=<?php echo $row3['id']; ?>"><?php echo $row3    ['nombre']; ?></a></td>
      </tr>
      <?php ?>
      <?php } else { echo ("Debe seleccionar una categoria"); 
?>
    </table></td>
    <td width="71"><table width="300" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <?php
if ($id_prod2 0) { ?>
        <?php while($row4=mysql_fetch_assoc($sql_exec4)){ ?>
        <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 $row4['imagen']; ?>" width="200" height="200"  border="0"/></a></td>
      </tr>
      <tr>
        <td align="center"><?php echo $row4['nombre']; ?></td>
      </tr>
      <tr>
        <td align="center"><?php echo $row4['codigo']; ?></td>
      </tr>
      <tr>
        <td align="center"><div align="justify"></div>
          <?php echo $row4['descripcion']; ?></td>
      </tr>
      <?php ?>
      <?php } else { echo ("Debe seleccionar una categoria"); 
?>
    </table></td>
  </tr>
</table>
</body>
</html>
http://indexa.com.ve/flamuko/prueba/...cat=1&id_sub=1
__________________
Diseño gráfico, Web, imagen corporativa, publicidad ...
  #22 (permalink)  
Antiguo 08/07/2008, 13:54
Avatar de foreverOdd  
Fecha de Ingreso: noviembre-2007
Ubicación: Caracas
Mensajes: 489
Antigüedad: 16 años, 5 meses
Puntos: 14
Respuesta: Fallo en impresion de datos...

se esta quedando el $_REQUEST['id_cat'] = '' al igual que $_REQUEST['id_sub'], ese es el error,
se nota claramente en
http://indexa.com.ve/flamuko/prueba/...=&id_sub=&id=1
__________________
My path is lit by my own fire, I only go where I desire
  #23 (permalink)  
Antiguo 08/07/2008, 13:58
Avatar de T4ke0veR  
Fecha de Ingreso: agosto-2007
Ubicación: Quito - Ecuador
Mensajes: 1.720
Antigüedad: 16 años, 8 meses
Puntos: 28
Respuesta: [ERROR]MySQL server version

solucionado...
aqui les dejo :D
Código PHP:
<?php include('conect.php');

$id_sub = -1;
if (isset(
$_REQUEST['id_cat'])) 
  
$id_sub $_REQUEST['id_cat']; 
  
$id_prod = -1
if (isset(
$_REQUEST['id_sub'])) 
  
$id_prod $_REQUEST['id_sub']; 
  
$id_prod2 = -1
if (isset(
$_REQUEST['id'])) 
  
$id_prod2 $_REQUEST['id']; 

$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() );

$sql4="SELECT * FROM productos WHERE id = $id_prod2";
$sql_exec4=mysql_query($sql4) or die( "[ERROR] Query: $sql4, 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">
        
<a href="ficha_cat.php?id_cat=<?php echo $row2['id_cat']; ?>&id_sub=<?php echo $row2['id_sub']; ?>"><?php echo $row2['nombre']; ?></a>        </td>
    </tr><?php ?><?php } else { echo ("Debe seleccionar una Subcategoria"); 
?>
  </table></td>
    <td width="71"><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">&nbsp;</td>
        <td width="230" align="center"><a href="ficha_cat.php?id_cat=<?php echo $row3['id_cat']; ?>&id_sub=<?php echo $row3['id_sub']; ?>&id=<?php echo $row3['id']; ?>"><?php echo $row3    ['nombre']; ?></a></td>
      </tr>
      <?php ?>
      <?php } else { echo ("Debe seleccionar una categoria"); 
?>
    </table></td>
    <td width="71"><table width="300" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <?php
if ($id_prod2 0) { ?>
        <?php while($row4=mysql_fetch_assoc($sql_exec4)){ ?>
        <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 $row4['imagen']; ?>" width="200" height="200"  border="0"/></a></td>
      </tr>
      <tr>
        <td align="center"><?php echo $row4['nombre']; ?></td>
      </tr>
      <tr>
        <td align="center"><?php echo $row4['codigo']; ?></td>
      </tr>
      <tr>
        <td align="center"><div align="justify"></div>
          <?php echo $row4['descripcion']; ?></td>
      </tr>
      <?php ?>
      <?php } else { echo ("Debe seleccionar una categoria"); 
?>
    </table></td>
  </tr>
</table>
</body>
</html>
http://indexa.com.ve/flamuko/prueba/ficha_cat.php

Gracias alapaco por tu tiempo!!!
__________________
Diseño gráfico, Web, imagen corporativa, publicidad ...
  #24 (permalink)  
Antiguo 08/07/2008, 14:06
Avatar de T4ke0veR  
Fecha de Ingreso: agosto-2007
Ubicación: Quito - Ecuador
Mensajes: 1.720
Antigüedad: 16 años, 8 meses
Puntos: 28
Respuesta: Fallo en impresion de datos...

ya lo soluciones forever
este es el codigo
Código PHP:
<?php include('conect.php');

$id_sub = -1;
if (isset(
$_REQUEST['id_cat'])) 
  
$id_sub $_REQUEST['id_cat']; 
  
$id_prod = -1
if (isset(
$_REQUEST['id_sub'])) 
  
$id_prod $_REQUEST['id_sub']; 
  
$id_prod2 = -1
if (isset(
$_REQUEST['id'])) 
  
$id_prod2 $_REQUEST['id']; 

$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() );

$sql4="SELECT * FROM productos WHERE id = $id_prod2";
$sql_exec4=mysql_query($sql4) or die( "[ERROR] Query: $sql4, 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">
        
<a href="ficha_cat.php?id_cat=<?php echo $row2['id_cat']; ?>&id_sub=<?php echo $row2['id_sub']; ?>"><?php echo $row2['nombre']; ?></a>        </td>
    </tr><?php ?><?php } else { echo ("Debe seleccionar una Subcategoria"); 
?>
  </table></td>
    <td width="71"><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">&nbsp;</td>
        <td width="230" align="center"><a href="ficha_cat.php?id_cat=<?php echo $row3['id_cat']; ?>&id_sub=<?php echo $row3['id_sub']; ?>&id=<?php echo $row3['id']; ?>"><?php echo $row3    ['nombre']; ?></a></td>
      </tr>
      <?php ?>
      <?php } else { echo ("Debe seleccionar una categoria"); 
?>
    </table></td>
    <td width="71"><table width="300" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <?php
if ($id_prod2 0) { ?>
        <?php while($row4=mysql_fetch_assoc($sql_exec4)){ ?>
        <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 $row4['imagen']; ?>" width="200" height="200"  border="0"/></a></td>
      </tr>
      <tr>
        <td align="center"><?php echo $row4['nombre']; ?></td>
      </tr>
      <tr>
        <td align="center"><?php echo $row4['codigo']; ?></td>
      </tr>
      <tr>
        <td align="center"><div align="justify"></div>
          <?php echo $row4['descripcion']; ?></td>
      </tr>
      <?php ?>
      <?php } else { echo ("Debe seleccionar una categoria"); 
?>
    </table></td>
  </tr>
</table>
</body>
</html>
y el funcionamiento lo puedes ver aqui
http://indexa.com.ve/flamuko/prueba/ficha_cat.php
gracias
__________________
Diseño gráfico, Web, imagen corporativa, publicidad ...
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 14:09.