On Saturday 25 May 2002 01:29, Steve Buehler wrote: > I am having trouble with the following function. What it should do is to > check one table for team_id's. Than it goes to another table and gets all > rows with that team_id. If the team_id is in the new table, it should do > one thing, else it should do something else. Can somebody look at this > code and see if they can find out where my problem is besides in my > inexperience? It always goes to the else statement inside the if > statement.
Your biggest problem is that you're trying to nest mysql_query() but you're only using 1 link identifier. You need to establish another connection using another mysql_connect(). > function searchbyteamname($team_name){ > GLOBAL $PHP_SELF; > $result=mysql_query("SELECT team_id,name FROM team WHERE name like > '%$team_name%' AND deleted NOT LIKE '1' ORDER BY 'name'"); > $i=1; > while (($row=mysql_fetch_object($result))){ > if(!($result1=mysql_query("SELECT * FROM team_season WHERE team_id = > '$row->team_id' AND deleted NOT LIKE '1'"))){ The value returned from mysql_query() is an indication of whether or not the query itself succeeded. It is not an indication of whether the query returned any records. -- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* Olmstead's Law: After all is said and done, a hell of a lot more is said than done. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php