At 01:54 AM 5/25/2002 +0800, Jason Wong wrote:
>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().

Why?  I can nest 1000's of these as long as I don't use $result= for each 
one.  As in the one below, I use $result= for one and $result1= for 
another.  I have it like that in a lot of my scripts.  You only need to 
have ONE connect to run these.  I use mysql_pconnect which will stay 
connected as long as the page is running.  If it is not possible to do, 
than PHP has a bug in it in the older and newest versions.  Try it out, it 
comes in real handy.  It keeps down the overhead of all of the connections 
that might have to be made during a script run.  I do agree that there are 
times when you should use mysql_connect and close it after running 
something, but for what I am doing, it makes more since and is easier on me 
if I use the mysql_pconnect.

> > 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.

Ok.  I should rephrase my first question.  If the query returns either 
nothing, or if it does not succeed, than it should do one thing, otherwise 
it should do something else.



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

Reply via email to