[UPHPU] Re: database query order
jtaber
jtaber at johntaber.net
Tue Sep 5 16:08:56 MDT 2006
This is interesting. I wonder if it should be SOP to put an "exit()"
after each header redirect.
John
Richard K Miller wrote:
>
> On Sep 5, 2006, at 10:53 AM, Richard K Miller wrote:
>
>> I've noticed that an UPDATE query that should come before the next
>> SELECT is actually coming after.
>>
>> The MySQL log shows the following, for instance:
>>
>> 10:47:32
>> 32 Connect
>> 32 Init DB
>> 33 Connect
>> 33 Init DB
>> 33 Query SELECT ...
>>
>> 10:47:33
>> 32 Query UPDATE ...
>> 33 Quit
>> 32 Quit
>>
>> I send the UPDATE statement before SELECT (notice the 32 vs. 33) but
>> it sometimes gets executed afterwards. How do I force the UPDATE to
>> finish before the SELECT? Do I need to switch from MyISAM to InnoDB
>> and use transactions or something?
>>
>> Richard
>>
>>
>
> Executing a write lock (LOCK TABLES table WRITE) before the UPDATE is
> the correct way of doing this. (UNLOCK TABLES after the UPDATE.)
>
> I had tried this before, but the real solution was a PHP problem (not
> MySQL.) I had one file redirecting to another with header("Location:
> "), but I had forgotten to put an exit() after the header(). As soon
> as I added exit(), the statements occurred in the correct order.
>
>
> _______________________________________________
>
> UPHPU mailing list
> UPHPU at uphpu.org
> http://uphpu.org/mailman/listinfo/uphpu
> IRC: #uphpu on irc.freenode.net
>
>
More information about the UPHPU
mailing list