php - Searching in ajax does not return result with spaces -


after clicking search button in page typically outputs result of query. have problem regards conditions value of field has white space. doing trim string , in database using statement.

    $(document).ready(function(){  $('#btnsearch').click(function(e) {         $("#content0 #sub_cont0").load("view/search.php?document=<?php echo $_get['document']; ?>&stat=<?php echo $_get['stat']?>&ac=<?php echo $_get['ac']; ?>&fac=<?php echo $_get['fac']; ?>&val=" + $("#txtsearch").val() + "&model=<?php echo trim($_get['model']);?>");         $(".tblmodellist").fadeout("slow");   }); }); 

example search word "casing". under category model = "test model". when queried in database, not output using query. note: in above script, trimmed model output "test" only. still not return expected result set.

  $sql =    "select * $db (     filename '%" . $id . "%' or     $title '%" . $id . "%' or     $no '%" . $id . "%' )     , (stat = '$stat' , model '%".$model."%')     "; 

what think problem in ajax request? have found earlier during debug when put $_get['model'] in center, cuts down query resulting in null value, reason why put in end of line.

<?     $urlparams = array('document', 'stat', 'ac', 'fac', 'model');     $urlquery = array();     foreach($urlparams $urlparam)         $urlquery[ $urlparam ] = $_get[$urlparam]; ?>  $(document).ready(function(){     $('#btnsearch').click(function(e) {         $("#content0 #sub_cont0").load("view/search.php?<?php echo http_build_query($urlquery); ?>&val=" + $("#txtsearch").val());         $(".tblmodellist").fadeout("slow");     }); }); 

Comments

Popular posts from this blog

java - JavaFX 2 slider labelFormatter not being used -

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -