I tried running the following code and it supposed to pick the value from the database but not picking.
$val = doautocomp('Brisbane');
HTTP::redirect($url_address.'/hotel-search/go/' . $val);
exit;
}
else {
HTTP::redirect($url_address.'/hotel-search/error');
exit;
}
}
function seoUrl($string) {
$string = strtolower($string);
$string = preg_replace("/[^a-z0-9_\s-]/", "", $string);
$string = preg_replace("/[\s-]+/", " ", $string);
$string = preg_replace("/[\s_]/", "-", $string);
return $string;
}
function doautocomp($mval) {
$linker = mysql_connect('localhost', 'root', 'pass');
$result3 = mysql_query("SELECT name FROM the.autocompletes where name LIKE '".$mval."%' LIMIT 0,1");
while($row = mysql_fetch_array($result3))
{
$val1 = $row['name'];
$mval = seoUrl($val1);
}
return $mval;
mysql_close($linker);
}
I also tried as but still its not working. RETURN TEST
$val = doautocomp('Brisbane');
HTTP::redirect($url_address.'/hotel-search/go/' . $val);
exit;
}
else {
HTTP::redirect($url_address.'/hotel-search/error');
exit;
}
}
function seoUrl($string) {
$string = strtolower($string);
$string = preg_replace("/[^a-z0-9_\s-]/", "", $string);
$string = preg_replace("/[\s-]+/", " ", $string);
$string = preg_replace("/[\s_]/", "-", $string);
return $string;
}
function doautocomp($mval) {
$linker = mysql_connect('localhost', 'root', 'pass');
$result3 = mysql_query("SELECT name FROM the.autocompletes where name LIKE '".$mval."%' LIMIT 0,1");
while($row = mysql_fetch_array($result3))
{
$val1 = $row['name'];
$mval = seoUrl($val1);
}
return "test"; //$mval;
mysql_close($linker);
}