geezz Posted December 3, 2012 Share Posted December 3, 2012 nice right up... i just have a slight problem getting this pagination working with multiple variables $province = $_GET['province'] ; $city = $_GET['city'] ; $keyword = $_GET['k'] ; $titles = $_GET['t'] ; my query is the problem ive tried $sql ="SELECT * FROM $tbl_name WHERE provinces = '".$_GET['province']."' AND city = '".$_GET['city']."' AND title like\"%$titles%\" AND keywords like\"%$keywords%\""; or $sql = "SELECT * FROM search WHERE provinces = '$province' AND city = '$city' AND title like'{$titles}_' AND keywords like'{$keyword}_'"; if i just put two variable it work $sql ="SELECT * FROM $tbl_name WHERE provinces = '".$_GET['province']."' AND city = '".$_GET['city']."' or $sql = "SELECT * FROM search WHERE provinces = '$province' AND city = '$city' how do i implement these 4 variable in one query.. is there any other changes i need to do in this php script any help will do thx in advance Link to comment https://forums.phpfreaks.com/topic/271556-pagination-working-with-multiple-variables-split-from-existing-thread/ Share on other sites More sharing options...
MDCode Posted December 3, 2012 Share Posted December 3, 2012 Please do not post an issue in another person's topic. You first query should work except you misspelled a variable Link to comment https://forums.phpfreaks.com/topic/271556-pagination-working-with-multiple-variables-split-from-existing-thread/#findComment-1397265 Share on other sites More sharing options...
geezz Posted December 3, 2012 Author Share Posted December 3, 2012 my bad noobie here thx for the fast reply well it was a typo by me...im pulling my hair cuz it should work but it doesnt why would two variables work and not all of them Link to comment https://forums.phpfreaks.com/topic/271556-pagination-working-with-multiple-variables-split-from-existing-thread/#findComment-1397269 Share on other sites More sharing options...
MDCode Posted December 3, 2012 Share Posted December 3, 2012 If they are not defined in the url, it would explain it. I've tested it on my site with no errors. Link to comment https://forums.phpfreaks.com/topic/271556-pagination-working-with-multiple-variables-split-from-existing-thread/#findComment-1397270 Share on other sites More sharing options...
geezz Posted December 3, 2012 Author Share Posted December 3, 2012 how would i do this? any ideas Link to comment https://forums.phpfreaks.com/topic/271556-pagination-working-with-multiple-variables-split-from-existing-thread/#findComment-1397273 Share on other sites More sharing options...
MDCode Posted December 3, 2012 Share Posted December 3, 2012 http://yourdomain.com/yourfile.php?province=whatever&city=blah&k=k&t=rawr Link to comment https://forums.phpfreaks.com/topic/271556-pagination-working-with-multiple-variables-split-from-existing-thread/#findComment-1397275 Share on other sites More sharing options...
geezz Posted December 3, 2012 Author Share Posted December 3, 2012 oh of course... /search2.php?province=AB&city=edmonton&t=trompo&k=restaurant now it show all my database it didint filter it using this $sql ="SELECT * FROM $tbl_name WHERE provinces = '".$_GET['province']."' AND city = '".$_GET['city']."' AND title like\"%$titles%\" AND keywords like\"%$keyword%\""; Link to comment https://forums.phpfreaks.com/topic/271556-pagination-working-with-multiple-variables-split-from-existing-thread/#findComment-1397280 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.