Re: [PHP] RE: [PHP-DB] Best way to check if a query succeeded

2001-03-30 Thread Christian Reiniger
On Friday 30 March 2001 16:25, you wrote: > > Wouldn't doing it like this however be ok: > > if ($result = mysql_query($query)) { > > I could be wrong, but I do not believe so. The You are wrong :) ($result = mysql_query(...)) assigns a value to result, and the entire expression evaluates

RE: [PHP] RE: [PHP-DB] Best way to check if a query succeeded

2001-03-30 Thread Boget, Chris
> Wouldn't doing it like this however be ok: > if ($result = mysql_query($query)) { I could be wrong, but I do not believe so. The above would evaluate as _true_ 100% of the time because irregardless of success of the query, $result is getting a value. It's just like doing: $i = "joe"; if(

Re: [PHP] RE: [PHP-DB] Best way to check if a query succeeded

2001-03-29 Thread Stuart J. Browne
> > Doesn't the command return 1 or 0 in success or failure? > > Not 1 or 0. It returns 0 or some other value. Almost the same, > but not quite. > > > You may not have a result > > Probably wrong but something like > > if (mysql_query($query)) { > > } else { > > } > > or you could die out mysql_

[PHP] Re: [PHP-DB] Re: [PHP] RE: [PHP-DB] Best way to check if a query succeeded

2001-03-29 Thread Terry Romine
On Thursday, March 29, 2001, at 08:32 AM, Nick Davies wrote: > Doesn't the command return 1 or 0 in success or failure? > > You may not have a result > > Probably wrong but something like > > if (mysql_query($query)) { > > } else { > > } What I understand is that the return from the query only

RE: [PHP] RE: [PHP-DB] Best way to check if a query succeeded

2001-03-29 Thread Boget, Chris
> Doesn't the command return 1 or 0 in success or failure? Not 1 or 0. It returns 0 or some other value. Almost the same, but not quite. > You may not have a result > Probably wrong but something like > if (mysql_query($query)) { > } else { > } > or you could die out mysql_query($query) or d

Re: [PHP] RE: [PHP-DB] Best way to check if a query succeeded

2001-03-29 Thread Nick Davies
Doesn't the command return 1 or 0 in success or failure? You may not have a result Probably wrong but something like if (mysql_query($query)) { } else { } or you could die out mysql_query($query) or die On Thu, 29 Mar 2001, Boget, Chris wrote: > > i was just wondering what you g