Foros del Web » Programando para Internet » PHP »

PARSE ERROR al asignar link

Estas en el tema de PARSE ERROR al asignar link en el foro de PHP en Foros del Web. Saludos ... tngo el siguiente problema, tngo un catalogo de productos donde me muestra el listado ordenado por categorias... ahora bien, cuando asigno vinculos a ...
  #1 (permalink)  
Antiguo 01/10/2007, 08: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
PARSE ERROR al asignar link

Saludos ... tngo el siguiente problema, tngo un catalogo de productos donde me muestra el listado ordenado por categorias... ahora bien, cuando asigno vinculos a la variable me da o parse error... o me vincula a partir del tercer articulo... de verdad no se donde tngo el error.. aqui les dejo mi codigo para ver si alguien puede hecharme una mano..
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>
   <?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['nombre']; }?>
                </a></td>    
          </tr>
                   
    </table>
  <?php } while ($row_Recordset1 mysql_fetch_assoc($Recordset1)); ?></body>
</html>
<?php
mysql_free_result
($Recordset1);

mysql_free_result($Recordset2);
?>
  #2 (permalink)  
Antiguo 01/10/2007, 10:16
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: PARSE ERROR al asignar link

disculpen q vuelva a escribir pero se pierde el tema y es urgente.. quien sepa se lo agradezco en el alma
  #3 (permalink)  
Antiguo 01/10/2007, 10:42
Avatar de GatorV
$this->role('moderador');
 
Fecha de Ingreso: mayo-2006
Ubicación: /home/ams/
Mensajes: 38.567
Antigüedad: 18 años
Puntos: 2135
Re: PARSE ERROR al asignar link

Te refieres a en esta parte?
Código PHP:
 <tr>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>
        <a href="ficha.php?PKID">
        <?php echo $prod['nombre']; }?>
                </a></td>    
          </tr>
Porque es el unico vinculo que veo.

Saludos.
  #4 (permalink)  
Antiguo 01/10/2007, 10: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
Re: PARSE ERROR al asignar link

exacto!!!! esa parte es.. los datos se estan perdiendo en algun sitio... de verdad no se donde....
  #5 (permalink)  
Antiguo 01/10/2007, 10:59
Avatar de GatorV
$this->role('moderador');
 
Fecha de Ingreso: mayo-2006
Ubicación: /home/ams/
Mensajes: 38.567
Antigüedad: 18 años
Puntos: 2135
Re: PARSE ERROR al asignar link

No veo que asignes ninguna variable, si quieres pasar alguna variable al hacer click en el link necesitas hacer algo asi:
Código PHP:
<a href="paginadestino.php?variable=<?php echo $valor?>">link</a>
Saludos.
  #6 (permalink)  
Antiguo 01/10/2007, 12:15
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: PARSE ERROR al asignar link

ahora solo me le da link al ultimo :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.php?PKID=<?php echo $prod['nombre']; ?>">
        <?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);
?>
  #7 (permalink)  
Antiguo 01/10/2007, 12:29
Avatar de GatorV
$this->role('moderador');
 
Fecha de Ingreso: mayo-2006
Ubicación: /home/ams/
Mensajes: 38.567
Antigüedad: 18 años
Puntos: 2135
Re: PARSE ERROR al asignar link

Segun tu algoritmo lo que estas haciendo es:
- Seleccionar todas las categorias.
- Hacer un ciclo por todas las categorias
- Seleccionar toda la info de productos donde sea igual a la categoria que estas mostrando
- Hacer un ciclo por todos los productos que sean iguales a la categoria actual
- Dibujar un link con el nombre actual del producto y un link al producto
- Fin del ciclo de productos
- Fin del ciclo de categorias

Ahora en tu estructura de HTML veo que cierras el </table> dentro del ultimo ciclo lo que hace que tu tabla se malforme, asi que te recomiendo limpies el codigo html para que te salgan todos los links.

Saludos.
  #8 (permalink)  
Antiguo 01/10/2007, 12:54
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: PARSE ERROR al asignar link

ya lo hice... y no sale ningun error... pero igual me lanza el link al ultimo producto...

hace esto

  #9 (permalink)  
Antiguo 01/10/2007, 13:13
Avatar de Seppo  
Fecha de Ingreso: marzo-2005
Ubicación: Buenos Aires, Argentina
Mensajes: 1.284
Antigüedad: 19 años, 1 mes
Puntos: 17
Re: PARSE ERROR al asignar link

Como te dijo GatorV, está desordenado el código, y terminás teniendo un error de HTML...
Lo primero sería que lo ordenes, pero si buscás una salida más "corta"te diría que está mal la llave que cerrás en el texto del link, parecería que tiene que ir después de cerrar el TR
  #10 (permalink)  
Antiguo 01/10/2007, 13: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
Re: PARSE ERROR al asignar link

ummmm bueno lo de la llave solo me provoco un error... peeeeero... voy a hacer de nuevo el sistema a ver como me va.... gracias :) luego les cuento
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 05:51.