I've got a small function which checks city name with post codes
And because this needs to be checked in several scripts I want to have it in
my common functions file
and include it !
  require ("common_funtions.inc");

and then use it
if (!check_city_from_plz($t_zipcode)){
echo  "<TR><TD colspan=\"2\"><B><I>Your city does not exist with the
plz!</I></B><BR></TD></TR>
";
}

It doesn't work though, I'm sure it something simple but can someone please
point me in the right direction !

This is the function itself

function check_city_from_plz($str) {
connect and select database
$city_query = "select distinct t_city_name,t_city_id_city from
t_city,t_zipcodecity where
(t_city_id_city = t_zipcodecity_id_city) and (t_zipcodecity_zipcode like
'$str')";

$city_result = mysql_db_query(DBWEB, $city_query);
if ($city_result) {
        while ($q = mysql_fetch_array($city_result)) {
            $city_id = $q["t_city_id_city"];
            $cityname = $q["t_city_name"];

if ($cityname !="") {
   return 1;
   return $city_id;
   return $cityname;
   } else {
   return 0;
   }

   } // close if
   } // close while
   } //  close function

Thanks in advance !




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to