Error al efectuar una busqueda Saludos mira tengo un problema al realizar una búsqueda, en este script se generan 5 busquedas, por id del socio, nombre, apellido, empresa, hotel, y por rango de fechas. las 4 funcionan pero la busqueda por hotel no, c donde esta el error pero no c como solucionarlo.
gracias mil
Luz Código PHP: <? session_start(); $xtr="../"; include '../include/language.php'; include '../database/i_conn.php'; include '../include/i_lib.php'; include ("../include/i_header.php"); $tname="puntos"; $select_fields="x.id,x.numsocio,x.idrubro,x.puntos,x.idhotel,x.monto,x.givendate,x.insdate,l.name name,l.lastname lastname,l.empresa empresa,l.status status,p.name categoria,k.name hotel"; $param="sname,slastname,sempresa,sid,sstatus,sidrubro,shotel"; if ((strlen($exhibition)==0) and (strlen($send)==0) ) { $exhibition=$_SESSION["wexhibition"]; } $from=" from ".$tname." x inner join socio l on (x.numsocio=l.numsocio) "; $from.=" left join category_rubros p on (x.idrubro =p.id) "; $from.=" left join hotel k on (x.idhotel = k.id) "; if (strlen($snumsocio)>0) { $where.=" and x.numsocio =".$snumsocio; } if (strlen($sempresa)>0) { $where.=" and l.empresa like '".$sempresa."%'"; } if (($sidrubro ==0) or ($sidrubro ==9)) { $where.=" and idrubro like '%'" ; } else{ $where.=" and idrubro = ".$sidrubro; } if (strlen($sname)>0) { $where.=" and l.name like '".$sname."%'"; } if (strlen($slastname)>0) { $where.=" and l.lastname like '".$slastname."%'"; } if (strlen($shotel)>0) { $where.=" and l.lastname like '".$shotel."%'"; /*aquí está el error si quito lastname y pongo hotel me genera un error, como está toma la busqueda por apellidos y lo hace bien, quisiera saber q estoy haciendo mal*/ } if (strlen($where)>0) { $where="where ".substr($where,5); } find_total_regs($from.$where,$ttl); $where.=" and status ='2' order by x.numsocio "; $extra=enlace(puntos_add.$extphp."?".create_param(1,"ttl,jmp"),$m[agregar],"add"); $param=$param.",jmp,ttl"; $sqlsel="select ".$select_fields.$from.$where." limit ".($jmp+0).",".$perpage; echo tableopen("94%",1,"",0,2,"center"," rules=none class=td_new"); echo formopen($_SERVER['SCRIPT_NAME']); echo tropen(); tdff($m[nombre],"sname",2,40,$fi++,$fi,$sname,""); tdff($m[hotel],"shotel",2,40,$fi++,$fi,$shotel,""); tdff ($m[categoria_rubros], "sidrubro",6,0,$fi++,$fi,$sidrubro,$m["vrcategoria"]); echo trclose(); echo tropen(); tdff($m[apellido],"slastname",2,40,$fi++,$fi,$slastname,""); tdff ("Buscar por Fecha"." ".$m[desde],"sdate_begin",7,11,$fi++,$fi,$sdate_begin,"desde"); echo trclose(); echo tropen(); tdff($m[empresa],"sempresa",2,40,$fi++,$fi,$sempresa,""); tdff ($m[hasta],"sdate_end",7,11,$fi++,$fi,$sdate_end,"hasta"); echo th(); echo nbsp(1).td(ff("send",4,0,$fi,"done",$m[buscar]," class=search_button"),"",2,1,"middle"," align=center"); echo trclose(); echo formclose(); echo tableclose(); echo th(); $result = $db->sql_query($sqlsel); $num_rows=$db->sql_numrows($result); if ($num_rows) { echo tableopen("94%",1,0,0,1,"center","class=list_table rules=none"); echo tropen("list_header"); echo th($m[numsocio]); echo th($m[fecha]); echo th($m[puntos],"",1,1,"top", "align=right"); echo th($m[monto],"",1,1,"top", "align=right"); echo th(); echo th($m[nombre]); echo th($m[apellido]); echo th($m[empresa]); echo th($m[categoria_rubro]); echo th($m[hotel]); echo trclose(); while ($row = $db->sql_fetchrow($result)) { echo td(codconvert($row[numsocio]),"numsocio"); echo td($row[insdate],"insdate"); $number = number_format($row[puntos], 0, ".", ","); echo td($number,"numt",1,1,"middle","align=right"); $number1 = number_format($row[monto], 2, ".", ","); echo td($number1,"num1t",1,1,"right","align=right nowrap"); echo td("",""); echo td(enlace($tname.$extphp."?id=".$row["id"]."&view=1".create_param(1,$param),$row[name],"list_data_link"," onmouseover=\"selrow(this);window.status='';return true;\" onmouseout=\"desel(this,'".eclase2($n)."');window.status='';return true;\" ")); echo td(enlace($tname.$extphp."?id=".$row["id"]."&view=1".create_param(1,$param),$row[lastname],"list_data_link"," onmouseover=\"selrow(this);window.status='';return true;\" onmouseout=\"desel(this,'".eclase2($n)."');window.status='';return true;\" ")); echo td(enlace($tname.$extphp."?id=".$row["id"]."&view=1".create_param(1,$param),$row[empresa],"list_data_link"," onmouseover=\"selrow(this);window.status='';return true;\" onmouseout=\"desel(this,'".eclase2($n)."');window.status='';return true;\" ")); echo td($row[categoria],"categoria"); echo td($row[hotel],"hotel"); echo trclose(); } echo tableclose(); } echo show_notification($_SESSION['notifylist']); include ("../include/i_footer.php"); ?> |