petonii Posted July 9, 2007 Share Posted July 9, 2007 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 >.< Quote Link to comment Share on other sites More sharing options...
The Little Guy Posted July 9, 2007 Share Posted July 9, 2007 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? Quote Link to comment 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.