fizzzgigg Posted June 3, 2006 Share Posted June 3, 2006 I have a database that I am trying to be able to navigate. To keep it simple I will use the states and cities. When you goto the site it needs to show all fifty states and then when you click the state you want, it will goto the cities of the states. I have gotten this far. My new, latest, and biggest problem is that cities alot of time, are more than two words. So the link looks like bobsite.com/find.php?state=NY&city=new it needs to look like bobsite.com/find.php?state=NY&city=new york city. I understand not passing spaces.Now here is the thing I have a huge database of about 350K rows, and they all have cities and states and then businesses. Each Business has its own unique ID; not each city. If you could click to the links above and have it list out all the businesses under New York City than it could easily be tranfered to that spefic business unique ID. What are some options that I can do here?one of my options was to build a separate table with just cities and states, and each city with have its unique id, and then use that id to fill in the holes to access the other table with the businesses. I just know there is another way.If only I could use a space in the url... I would be done with this. I have it to where you type the zip code, but the problem there is you may not know the zip code to the city you are looking in. Plus wont google's spider suck up my complete database if I have a links to each row?Adam Quote Link to comment https://forums.phpfreaks.com/topic/11119-solved-navigating-the-database/ Share on other sites More sharing options...
Barand Posted June 3, 2006 Share Posted June 3, 2006 Can't see the problem with spaces:: test.php ::[code]<?php if (isset($_GET['city']))echo "<H1>{$_GET['city']}</H1>";?><a href='?city=New York City'>NY</a><BR><a href='?city=Los Angeles'>CA</a>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/11119-solved-navigating-the-database/#findComment-41587 Share on other sites More sharing options...
fizzzgigg Posted June 3, 2006 Author Share Posted June 3, 2006 well when I run my mouse over the top it only shows the first word to the link. I also just checked the source and it does show the both words. When I put my mouse over the buttom it will just show the first word. Quote Link to comment https://forums.phpfreaks.com/topic/11119-solved-navigating-the-database/#findComment-41597 Share on other sites More sharing options...
fizzzgigg Posted June 4, 2006 Author Share Posted June 4, 2006 Here is the code on how the table is built. [code]<? $result=mysql_query("SELECT DISTINCT city,state FROM church WHERE state='$state'"); $i=0; while( $row=mysql_fetch_array($result) ) { if($i>0) { echo "<tr valign=bottom>"; echo "<td bgcolor=#2172A1 colspan=6><img src=img/blank.gif width=1 height=1></td>"; echo "</tr>"; } echo "<tr valign=center>"; echo "<td class=tabval><b><a href=findnew3.php?state=".$state."&city=".$row['city'].">".$row['city']."</a></b></td>"; echo "<td class=tabval></td>"; echo "</tr>"; $i++; } echo "<tr valign=bottom>"; echo "<td bgcolor=#2172A1 colspan=9><img src=img/blank.gif width=1 height=8></td>"; echo "</tr>";?>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/11119-solved-navigating-the-database/#findComment-41624 Share on other sites More sharing options...
Barand Posted June 4, 2006 Share Posted June 4, 2006 You should get into the habit of using quotes around the attribute values within tags.// unquoted[code]<A href=findnew3.php?state=NY&city=New York City>Click</A> ^ | url assumed to finish here--+[/code] // quoted[code]<A href='findnew3.php?state=NY&city=New York City'>Click</A> ^ | url assumed to finish here--+[/code] Quote Link to comment https://forums.phpfreaks.com/topic/11119-solved-navigating-the-database/#findComment-41632 Share on other sites More sharing options...
fizzzgigg Posted June 5, 2006 Author Share Posted June 5, 2006 Oh your beautiful. Sorry about the quoute thing too. Quote Link to comment https://forums.phpfreaks.com/topic/11119-solved-navigating-the-database/#findComment-41909 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.