Ver Mensaje Individual
  #3 (permalink)  
Antiguo 06/03/2006, 13:51
iarrieta
 
Fecha de Ingreso: noviembre-2002
Ubicación: Colombia
Mensajes: 278
Antigüedad: 24 años
Puntos: 0
Si uso like

Código PHP:
<?
//inicializo el criterio y recibo cualquier cadena que se desee buscar 
$criterio = ""; 
$txt_criterio = "";
if (empty(
$id_hija)){
 
$txt_criterio=$id_padre;
 
$criterio = " where categoria like '%" . $txt_criterio . "%' OR subcategoria like '%" . $txt_criterio . "%'"; 
}else
if (isset(
$id_hija)){
 
$txt_criterio=$id_hija;
 
$criterio = " where categoria like '%" . $txt_criterio . "%' OR subcategoria like '%" . $txt_criterio . "%'"; 
}
 
$sql="SELECT * FROM clientes".$criterio; 
$res=mysql_query($sql); 
$numeroRegistros=mysql_num_rows($res); 
if(
$numeroRegistros<=0)
{
//...etc etc
?>
Antes que todo me conecto, claro.

Lo cambie por:

Código PHP:
<?
//inicializo el criterio y recibo cualquier cadena que se desee buscar 
$criterio = ""; 
$txt_criterio = "";
if (empty(
$id_hija)){
 
$txt_criterio=$id_padre;
 
$criterio = " where categoria = '$txt_criterio' OR subcategoria = '$txt_criterio'"; 
}else
if (isset(
$id_hija)){
 
$txt_criterio=$id_hija;
 
$criterio = " where categoria = '$txt_criterio' OR subcategoria = '$txt_criterio'"; 
}
 
$sql="SELECT * FROM clientes".$criterio; 
$res=mysql_query($sql); 
$numeroRegistros=mysql_num_rows($res); 
if(
$numeroRegistros<=0)
{
//...etc etc
?>
Y listo, asi funciona perfecto.. Muchas gracias por tu ayuda csalazar146!