How can I display an invalid postal code in a table

On my Aeronautics Web site, we have a feedback form, one of the questions is the postcode where the visitor came. It works very well. The summary of the results tab includes a list of choices for the zip code where I show the city associated with the postal code and then how many responses came from this zip code. This can be seen here http://www.hollisterairshow.com/feedback-results.php?tab=7

In testing, I found that an invalid postal code is not displayed in the summary table, although it is counted in the total number of responses. I would display invalid zip code and let the city empty or perhaps put "invalid zip Code". The current code is shown below, it's beyond my ability to understand how I should change to display invalid postal codes and I would really appreciate some advice on this.

I know I could validate the postal code at the entrance, but it is quite possible that the postal code table I is expired and I can't find a downloadable list for free, so I think that anything wrong could cause update me my table.which is very good.

Thanks for any help.

Tony

< div class = "TabbedPanelsContent" >

<? PHP


Connect MySQL

$query = "SELECT feedback.zip, COUNT (feedback.zip), zipcodes.citystate OF feedback, postcodes WHERE feedback.zip = zipcodes.zipcode GROUP BY feedback.zip";

$result = mysql_query ($query) or die (mysql_error ());

Print results

While ($Row = mysql_fetch_array ($result))

{
echo $row ["zip"]. " ". $row ['COUNT (feedback.zip)']. " ". $row ["citystate"];
echo "< br / > ';
}
? >

< / div >

Use an external on two tables join so that results are returned for all the lines of comments, instead of just matching rows. The zipcodes.citystate column will be NULL. In the output of your recordset, you can test for null in the column and fill it with "Invalid postal Code", if you wish.

You will need to join in the FROM clause, because I believe that MySQL does not support the outer joins in the WHERE clause like most other DBMS.

Tags: Dreamweaver

Similar Questions

Maybe you are looking for