PHP & MySQL Database Query Question?

  • Thread starter Thread starter Phil M
  • Start date Start date
P

Phil M

Guest
I am using a database with zipcode, city, & state fields. I want to use a "enter Zip Code" Field, but want to return "City, State" and nothing else. I am trying to setup PHP code and I am having a hard time. Here is the code:

(pleaseignore)php
$zipcode = $_GET['zipcode'];
$city = $_GET['city'];
$state = $_GET['state'];

$dbc = mysqli_connect('localhost', 'parisil_phil', 'password', 'parisil_insurancedata')
or die ('I cannot connect to the database');

$query = "SELECT * FROM allzip";
$result = mysqli_query($dbc, $query)
or die ('Error Querying Database.');

$row = mysqli_fetch_array($result)

echo $city;
echo $state;

mysqli_close($dbc);

pleaseignore?>

NOTE: please ignore is not part of script,, yahoo won't let me post the script
What is wrong? It is mostly in the echo part. I need the city and state to echo in 1 spot on my page. Example: I type in 61920 , and then the next page it should show Charleston, IL

anyone with help, it would be awesome.
You did it! Thanks!
 
Back
Top