Thank you Michael. I learned a lot from your detailed explanation
of how the update and select functions work in relation to
checking for good execution.
if (mysql_affected_rows() == 1)
and got the results I was after.
I am stilling having problem with users browser
caching the screen, but will post that as separate question.
Again thanks for your expert help.
From: Michael Stassen [mailto:Michael.Stassen@stripped]
Sent: Monday, March 13, 2006 4:18 AM
Subject: Re: Checking for good update
> On Sun, 12 Mar 2006, Michael Stassen wrote:
>>>looks a bit strange to me.
>>>>$result = mysql_query($query) or die('Query couldn\'t
>>>please try something like this:
>>Why? There's nothing wrong with the above statement.
> I've never seen logic like that before. It looks to me like
> fbsd_user is trying to use the OR operator outside an if
> Is the mentioned in the php manual somewhere Michael?
>>>I've not tested this - but it looks like you are mixing sending
>>>mysql query and testing for the result of the query at the same
>>>which AFAIK is not possible.
>>You should try it. It works just fine, and isn't the problem.
>>problem is that you cannot treat the result of an UPDATE as if it
> Keith Roberts
Yes, this is documented. It's also standard practice (in perl and C
OR is not part of an if statement, it is a logical operator.
<http://www.php.net/manual/en/language.operators.logical.php> "A or
B" has a
value, true or false, depending on the values of A and of B. In
fact, if A is
true, then "A or B" is certainly true, so there's no need to look at
B at all.
This short-circuit evaluation, combined with the fact that every
returns the assigned value
<http://www.php.net/manual/en/language.expressions.php>, makes a
$result = mysql_query($query) or die('Query
First, the function mysql_query() is called. Its return value is
$result, *and* returned as the return value of the assignment
operator (=). Now
we know A. If mysql_query succeeded, its return value (A) evaluates
as true, so
the or operation must be true, so no need to look at B. If, on the
A is false (mysql_query failed), we must evaluate B to determine the
the "or" expression. Of course, to determine the value of B, we
have to call
the referenced function, die().
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql