javascript - I want to match data from my database to googlelocation dropdown -
this website underconstruction please go upper link , click on signup drive (blue cruve button) there tab open type london (not drop down) type london , hit enter page redirect
dev.appcotech.com/pwrdup/static/become-postie-vehicle.php
page (this mean post keyword matched 100% database) come previous page , again type london time dropdown menu find london, united kingdom,and hit enter. same city database have keyword london.so page redirect
dev.appcotech.com/pwrdup/static/city-unavailables.php
this mean result not matched 100%
i want match city london, united kingdom database keyword london. have letters london in database here code.
require_once "connection/connection.php"; if($_post) { $a = $_post['address'] ; $sql = "select * tbl_city city_name '%$a%'"; $res = mysql_query($sql); $result = mysql_fetch_array($res); if($result >=1){ header("location:become-postie-vehicle.php"); die(); }else{ header("location:city-unavailables.php"); die(); } where $a = $_post['address'] ; input field name (where use search) please let me know how can match city database?my database given below
create table if not exists `tbl_city` ( `id` int(100) not null, `city_name` varchar(100) not null ) engine=innodb auto_increment=2 default charset=latin1; insert `tbl_city` (`id`, `city_name`) values (1, 'london'); now please me find out solution. remember have used regexp match() ... against in $sql already.it challenging ever. anyone have solution???
i have got answer daniweb.com
if you're going have same format of city comma followed something, write query substring_index split on comma. if isn't going way, of course wouldn't able that.
select * tbl_city city_name substring_index('london, united kingdom', ',', 1); this splits string on first comma, , uses value of 'london' in search.
or
you split string in php prior running query.
Comments
Post a Comment