Foros del Web » Programando para Internet » PHP »

AYUDA: problema mostrando productos

Estas en el tema de AYUDA: problema mostrando productos en el foro de PHP en Foros del Web. Necesito ayuda urgente pls... tngo un listado de productos pero el problema es q solo me muestra a partir del segundo producto... o sea el ...
  #1 (permalink)  
Antiguo 28/09/2007, 13: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
AYUDA: problema mostrando productos

Necesito ayuda urgente pls... tngo un listado de productos pero el problema es q solo me muestra a partir del segundo producto... o sea el primero q sale ingresado en la data jamas sale!!!! alguien puede decirme el error?

pero es el primero de cada categoria ejemplo
en la base de datos tngo
de la categoria
zapato
tngo lso prodcutos
1- rojo
2- negro
3- azul
solo me salen negro y azul.... el rojo q es el primero de esa categoria no me sale

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

mysql_select_db($database_listproduc$listproduc);
$query_Recordset1 "SELECT * FROM categoria";
$Recordset1 mysql_query($query_Recordset1$listproduc) or die(mysql_error());
$row_Recordset1 mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 mysql_num_rows($Recordset1);


?><!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>
<?php do { ?>
  <table width="61%" border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td width="5%">&nbsp;</td>
      <td colspan="2"><?php 

      
      
echo $row_Recordset1['nombre']; ?></td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td width="5%">&nbsp;</td>
      <td width="90%"><?php 
          mysql_select_db
($database_listproduc$listproduc);
        
$query_Recordset2 "SELECT * FROM producto WHERE PKIDCAT =".$row_Recordset1['PKID'];
        
$Recordset2 mysql_query($query_Recordset2$listproduc) or die(mysql_error());
        
$row_Recordset2 mysql_fetch_assoc($Recordset2);
        
$totalRows_Recordset2 mysql_num_rows($Recordset2);
        
        while(
$prod=mysql_fetch_assoc($Recordset2)){
        echo 
$prod['nombre']; }?></td>
    </tr>
      </table>
  <?php } while ($row_Recordset1 mysql_fetch_assoc($Recordset1)); ?></body>
</html>
<?php
mysql_free_result
($Recordset1);

mysql_free_result($Recordset2);
?>
solo se me muestra los resultados a partir del segundo pero no entiendo por que :S
  #2 (permalink)  
Antiguo 28/09/2007, 14:50
Avatar de T4ke0veR  
Fecha de Ingreso: agosto-2007
Ubicación: Quito - Ecuador
Mensajes: 1.720
Antigüedad: 16 años, 8 meses
Puntos: 28
Re: AYUDA: problema mostrando productos

ok .. respondo en el mismo mail por lo siguiente... ya me funciona pero al darle vinculo a los productos me lanza error de sintax... y parse error...

ahora dandole vinculo me dice parse error en linea 84 q es la ultima :S:S
Código PHP:
<?php require_once('Connections/listproduc.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;
}
}

mysql_select_db($database_listproduc$listproduc);
$query_Recordset1 "SELECT * FROM categoria";
$Recordset1 mysql_query($query_Recordset1$listproduc) or die(mysql_error());
$row_Recordset1 mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 mysql_num_rows($Recordset1);


?><!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>
<?php do { ?>
  <table width="61%" border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td width="5%">&nbsp;</td>
      <td colspan="2"><?php 

      
      
echo $row_Recordset1['nombre']; ?>        </td>
    </tr>
   <?php mysql_select_db($database_listproduc$listproduc);
        
$query_Recordset2 "SELECT * FROM producto WHERE PKIDCAT =".$row_Recordset1['PKID'];
        
$Recordset2 mysql_query($query_Recordset2$listproduc) or die(mysql_error());
        
        
$totalRows_Recordset2 mysql_num_rows($Recordset2);
        
        while(
$prod=mysql_fetch_assoc($Recordset2)){?>

        
        <tr>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>
        <a href="ficha_prod.php?PKID=<?=$prod['PKID']?>">
        <?=$prod['nombre'];?>
        </a> 

                </td>    
          </tr>
                   
    </table>
  <?php } while ($row_Recordset1 mysql_fetch_assoc($Recordset1)); ?></body>
</html>
<?php ?>
<?php
mysql_free_result
($Recordset1);

mysql_free_result($Recordset2);
?>
  #3 (permalink)  
Antiguo 28/09/2007, 15:10
Avatar de ferbux  
Fecha de Ingreso: mayo-2007
Ubicación: por ahí intentado ayudar
Mensajes: 823
Antigüedad: 16 años, 11 meses
Puntos: 6
Re: AYUDA: problema mostrando productos

Hola puede ser ke se te haya kedado alguna llave abierta o hayas puesto alguna de mas o de menos
__________________
"Eres grande por que caminas entre gigantes"
  #4 (permalink)  
Antiguo 28/09/2007, 15: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
Re: AYUDA: problema mostrando productos

pero es q fijate... si quitas el href.. funciona.. al colocarlo es donde da error...!!!!
Código PHP:
<a href="ficha_prod.php?PKID=<?=$prod['PKID']?>">
        <?=$prod['nombre'];?>
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 20:13.