My function site in my signature is the site in question. Then you fill in the search form, it displays the relevant results. What i would like is to generate something like a directory. I basically want to create a page which is a City name. For instance London, and then it display all the results from london. But i dont want it to be showing after the search button has been pressed, i would like it to display the relevant results automatically. Could anyone help?
you have two sites in your sig. would you like check them both? any way try to use the "LIKE" in your sql statement ..... WHERE something LIKE '%$search%' ....
I do, which is why i said the Function site in my signature, the other is premier league The current code i use in the search section is <?php echo $resultList; ?> So i would need to change that to: <?php echo Like "London" $resultList; ?>? Or am i miles out?
no. Basically i have a load of entries in my database, i want to create various city pages. I want to have a page called london.php, manchester.php etc On london.php i would like it to display the entries from London and so on.
hmm, although it sound good, your server will suffer a lot because if you do it the way like you mentioned, then you would have to do a query for every keypress
do this this then have a file called city.php pass the city.php the city via query string city.php?city=london & city.php?city=manchester now in city.php $_GET['city'] will give u london or machester build a search sql query based on the same LIKE select * from city WHERE name like '%$city%' hope this helps u can do URL rewriting if u want urls like london.html etc ..
thanks for that, i think that will be too difficult for me to do. But i appreciate you taking the time out. I might give it a try over the weekend.
Ive been told for SEO purposes on my site something like this would be ideal (even without the URL rewriting. Im wondering if someone could help expand on this for me. Im not interested in url rewriting as im sure thats more difficult and im after just creating something simple for now and build on it over time.
There are several ways. 1- create a php file as city.php and do as told (use mod_rewrite for sure for seo urls) 2- create a php file but get scriptname and do your query due to the name (same code but copied for each city) for all the query will be something like that (from your page i think each city is called via their id numbers from sql which may result in having two tables "one for cities" and "one for records") Select * from records LEFT JOIN (cities) ON (cities.id=records.city_id) WHERE cities.id='id_ofcity(eg. 1 for aberdeen)'