Jump to content

Search engine for suburbs


petonii

Recommended Posts

Hello fellow programmers,

 

I am new to this site and was looking around for some good advice or if i am lucky some help.

 

I am starting off a basic local business search project just for some practice.

 

I need some tutorial or some example code. I don't want to waste too much time for others so ill make this quick.

 

http://au.local.yahoo.com/ This link shows 2 search bars. I only want to know the postcode search side of things.

I wanna be able to write 90210 for example and then every business with the postcode 90210 comes up on a custom page.

How do you label each business with a postcode and make it up on a section of my website?

 

I hope this is clear. If any fingers can be pointed to a very clear source that would be great. I understand some coding but not advanced enough to write it from scratch.

 

Thanks in advanced

 

Peace >.<

Link to comment
Share on other sites

each business needs to have their postal code in your databse, then you do an SQL search:

 

<?php
if(is_numeric($_POST['postCode'])){
   $postCode = $_POST['postCode'];
   $sql = mysql_query("SELECT * from `dataBaseName` WHERE `postCode` = '$postCode'")or die(mysql_error());
   if(mysql_num_rows($sql) < 1){
      echo 'Nothing found.';
   }else{
      while($row = mysql_fetch_array($sql)){
         echo '<p>'.$row['businessName'].'</p>';
      }
   }
}else{
   echo 'Please enter a number';
}
?>

 

Does this answer your question or was I off?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.