Ver Mensaje Individual
  #4 (permalink)  
Antiguo 05/06/2007, 08:17
Avatar de GatorV
GatorV
$this->role('moderador');
 
Fecha de Ingreso: mayo-2006
Ubicación: /home/ams/
Mensajes: 38.567
Antigüedad: 18 años
Puntos: 2135
Re: Listar todos los registros codigo

Prueba esto:
Código PHP:
<?php
session_start
();
 
$file fopen("tabla.htm""r");
      
$html fread($filefilesize("tabla.htm"));
      
fclose($file);
include(
'init.inc');
//Conectamos con la base de datos 
$conect=mysql_connect($hostname_localhost$username_localhost$password_localhost);
$db=mysql_select_db($database_localhost$conect);

$resguardos="SELECT * FROM resguardos";
$res=mysql_query($resguardos); 
echo 
"<table>";
while (
$row=mysql_fetch_array($res))
{
$cliente=$row['id_cliente'];
$clientes="SELECT * FROM clientes where id_cliente=$cliente";
$res2=mysql_query($clientes); 
while (
$row2=mysql_fetch_array($res2))
{
$nombre=$row2['nombre_apellidos'];
$num=$row['id_resguardo'];
$fechaentrada=$row['fecha_entrada'];
$estado=$row['estado_averia'];
$fac=$row['n_factura'];
echo 
"<tr><td>".$num."</td><td>".$fac."</td><td>".$cliente."</td><td>$nombre</td><td>".$fechaentrada."</td><td>".$estado."</td><td><a href='modificar_resguardo_plantilla.php?id_resguardo=xxnumxx&amp;id_cliente=$cliente'><img src='imagenes/edit.png' alt='Modificar' width='16' height='16' border='0' /></a><a href='desactivar_averia.php?id_resguardo=xxnumxx'><img src='imagenes/desactiva.jpg' alt='Entregada' width='20' height='20' border='0' /></a><a href='ver_resguardo_pdf.php?id_resguardo=xxnumxx' target='_blank'><img src='imagenes/pdf.png' alt='Generar PDF' width='16' height='16' border='0' /></a><a href='borrar_resguardo.php?id_resguardo=xxnumxx'><img src='imagenes/delete.png' alt='Borrar' width='16' height='16' border='0' /onclick='if(confirm('&iquest;Desea Borrar Realmente este Registro') == false){return false;}'/></a></td></tr>";
}
}
echo 
"</table>";
?>
Si te imprime todos los datos, entonces el problema esta en tu forma de imprimir el template, al usar str_replace solo reemplaza la primera instancia, debes de pensar en otra forma de usar tus ciclos con templates.

Saludos.