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!