Foros del Web » Programando para Internet » PHP »

Catalogo de productos

Estas en el tema de Catalogo de productos en el foro de PHP en Foros del Web. saludos, hice un listado de productos donde al hacer click a cada uno deberia ir a una hoja donde se muestren sus detalles y sus ...
  #1 (permalink)  
Antiguo 16/10/2007, 06:45
Avatar de T4ke0veR  
Fecha de Ingreso: agosto-2007
Ubicación: Quito - Ecuador
Mensajes: 1.720
Antigüedad: 16 años, 8 meses
Puntos: 28
Catalogo de productos

saludos,
hice un listado de productos donde al hacer click a cada uno deberia ir a una hoja donde se muestren sus detalles y sus imagenes.. ahora bien... lo hago mas no me sale nada... alguien podria ayudarme???

aqui les dejo mi codigo...
Listado de productos!!!
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.php?PKID=<?php echo $prod['PKID']; ?>"><?php echo $prod['nombre']; }?>
                </a></td>    
          </tr>       
    </table>
  <?php } while ($row_Recordset1 mysql_fetch_assoc($Recordset1)); ?>

<? ?>

</body>
</html>

<?php
mysql_free_result
($Recordset1);

mysql_free_result($Recordset2);
?>
y de la pagina ficha
Código PHP:
<?php include ('Connections/listproduc.php');

$date=date('Y-n-d G:i:s');

@
$Id_articulo=$_REQUEST['PKID'];



$sql="SELECT * FROM producto WHERE PKID= $PKID";

$sql_exec=mysql_query($sql);

$sql_execqz=mysql_query($sqlqz);



while(
$row=mysql_fetch_assoc($sql_exec)){

    

    
$PKID $row['PKID'];

    
$nombre $row['nombre'];

    
$descripcion $row['descripcion'];

    
$imagen $row['imagen'];

    }

?>
<!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>
<style type="text/css">
<!--
body {
    margin-left: 0px;
    margin-top: 0px;
    margin-right: 0px;
    margin-bottom: 0px;
}
.style1 {
    font-family: Tahoma;

    font-weight: bold;

    font-size: 11px;

    color: #0066CC;
}
-->
</style></head>

<body>
<table width="82%" border="0" align="center">
  <tr>
    <td colspan="3" class="azul_verd_nrm"><span class="azulgrs_tah"><strong>
      <?=$nombre?>
    </strong></span></td>
    <td width="38%" rowspan="4" valign="top" class="gris_tah_nrm"><div align="center"><img src="<?=$imagen?>" width="200" height="200" alt="" /></div></td>
  </tr>
  <tr>
    <td colspan="3" class="azul_verd_nrm"><span class="style1">
      <?=$descripcion?>
    </span></td>
  </tr>
  <tr>
    <td colspan="3" class="azul_verd_nrm"><div align="justify"><span class="azulgrs_tah"> <?php echo nl2br($descripcion);?> </span></div></td>
  </tr>
  <tr>
    <td colspan="3" valign="top" class="azul_verd_nrm">&nbsp;</td>
  </tr>
</table>
</body>
</html>
  #2 (permalink)  
Antiguo 16/10/2007, 07:16
Avatar de webseficientes  
Fecha de Ingreso: enero-2005
Ubicación: Buenos Aires, Argentina
Mensajes: 320
Antigüedad: 19 años, 3 meses
Puntos: 14
Re: Catalogo de productos

En tu pagina del producto
Código:
@$Id_articulo=$_REQUEST['PKID'];
$sql="SELECT * FROM producto WHERE PKID= $PKID";
que valor tiene $PKID, si nunca lo seteaste?
__________________
Gerardo Benitez
Programador Web Freelance, SEO, Diseño web
  #3 (permalink)  
Antiguo 16/10/2007, 07:19
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: Catalogo de productos

ok dejame eliminar ese.. tienes razon... aunq no se pq no me muestra la imagen :S
  #4 (permalink)  
Antiguo 16/10/2007, 07:26
Avatar de webseficientes  
Fecha de Ingreso: enero-2005
Ubicación: Buenos Aires, Argentina
Mensajes: 320
Antigüedad: 19 años, 3 meses
Puntos: 14
Re: Catalogo de productos

Seguramente de la imagen estas guardando y recuperando solo el nombre, no la ruta, igual no esta mal guardar solo el nombre, solo que tenes que recordar de agregar el prefijo de la ruta.
__________________
Gerardo Benitez
Programador Web Freelance, SEO, Diseño web
  #5 (permalink)  
Antiguo 16/10/2007, 07:37
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: Catalogo de productos

RESUELTO... lo hice desde 0... gracias por tu atencion man.. aqui t dejo para q veas lo q hice
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;
}
}

$colname_Recordset1 "-1";
if (isset(
$_GET['PKID'])) {
  
$colname_Recordset1 $_GET['PKID'];
}
mysql_select_db($database_listproduc$listproduc);
$query_Recordset1 sprintf("SELECT * FROM producto WHERE PKID = %s"GetSQLValueString($colname_Recordset1"int"));
$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>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="28%"><?php echo $row_Recordset1['nombre']; ?></td>
    <td width="72%"><img src="images2/<?php echo $row_Recordset1['imagen']; ?>" /></td>
  </tr>
  <tr>
    <td><?php echo $row_Recordset1['descripcion']; ?></td>
    <td>&nbsp;</td>
  </tr>
</table>
</body>
</html>
<?php
mysql_free_result
($Recordset1);
?>
  #6 (permalink)  
Antiguo 16/10/2007, 09:52
Avatar de helthon  
Fecha de Ingreso: junio-2005
Ubicación: Lima
Mensajes: 549
Antigüedad: 18 años, 10 meses
Puntos: 7
Re: Catalogo de productos

Porque :

[PHP]
$query_Recordset1 = sprintf("SELECT * FROM producto WHERE PKID = %s", GetSQLValueString($colname_Recordset1, "int"));


//tu variable no es
// $colname_Recordset1 = $_GET['PKID'];
PHP]

Todo lo haces en el dreamweaver ??
__________________
HELTHON FUENTES
FLORERIA FLORES PERU Floresperu.com.pe
Garantizamos que cada entrega de flores será de la más alta calidad y frescura
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 15:18.