Ver Mensaje Individual
  #9 (permalink)  
Antiguo 08/02/2009, 20:36
warbandit69
 
Fecha de Ingreso: diciembre-2008
Ubicación: http://www.solucionesrios.tk/
Mensajes: 413
Antigüedad: 15 años, 4 meses
Puntos: 19
Respuesta: Problemas con sonsulta SQL con matriz e implode en PHP

Ok amigos muchas gracias, ya solvente de la siguiente forma, a continuación les pego el còdigo:

Código PHP:
<?php include "conectarse.php"?>
<!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>Sistema de Inventario MyA</title>
</head>
<body>
<p>&nbsp;</p>
<p>
 <center> <?php
$cedula 
$_POST['cedula'];
$nombre $_POST['nombre'];
$cargo $_POST['cargo'];

$cedula mysql_real_escape_string($cedula);
$nombre mysql_real_escape_string($nombre);
$cargo mysql_real_escape_string($cargo);

if(
$cedula!="")
{
$where_cedula "cedula LIKE '%".$cedula."%'";
}
else
{
$where_cedula "cedula LIKE '%'";
}
if(
$nombre!="")
{
$where_nombre " nombre LIKE '%".$nombre."%'";
}
else
{
$where_nombre "nombre LIKE '%'";
}
if(
$cargo!="")
{
$where_cargo " cargo LIKE '%".$cargo."%'";
}
else
{
$where_cargo "cargo LIKE '%'";
}

$where_array = array($where_cedula$where_nombre$where_cargo);
$where implode(" AND "$where_array);

$query "SELECT * FROM responsable WHERE ".$where." ORDER BY cedula";  // Esta es la linde adonde tengo problemas

$result mysql_query($query);

if(!
$result)
{
    exit(
"hay un error con la consulta : ".mysql_error());
}
else
{
echo 
"<table width=100% border=1 cellspacing=1 cellpadding=1><tr bgcolor=#009900 align=center><td><div align=center>
<em><strong>C&Eacute;DULA</strong></em></div></td><td><div align=center>
<em><strong>NOMBRE</strong></em></div></td><td><div align=center>
<em><strong>CARGO</strong></em></div></td></tr>"
;
while(
$row mysql_fetch_array ($result))
{
echo 
"<TR>
<TD WIDTH=5% ALIGN=CENTER>$row[cedula]</TD>
<TD WIDTH=10% ALIGN=center>$row[nombre]</TD>
<TD WIDTH=20% ALIGN=CENTER>$row[cargo]</TD>
</TR>"
;
}
echo 
"</TABLE></form>";
}

mysql_free_result($result);
include 
"desconectarse.php"



?></center>
</p>
<div align="center">
  <p>&nbsp;</p>
  <p><a href="/Activos2/busqueda_responsables.php">Regresar/Nueva Búsqueda</a></p>
</div>
</body>
</html>
Espero a alguien le sirva.

Saludos