function sql question

From: Date: Sun, 05 May 2002 16:34:37 +0000
Subject: function sql question
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-96155@lists.php.net to get a copy of this message
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 !

« previous php.general (#96155) next »