You are here: Re: How do I handle people going into the same record at the same in web app. « PHP Programming Language « IT news, forums, messages
Re: How do I handle people going into the same record at the same in web app.

Posted by Jerry Stuckle on 05/21/06 16:39

Rik wrote:
> Jerry Stuckle wrote:
>
>>Sure you can guarantee it.
>>
>> $result = mysql_query("UPDATE myTable SET col1='$col1' AND
>> col2='$col2'] "WHERE col1='$oldcol1' AND
>> col2='$oldcol2'"); if (mysql_affected_rows != 1)
>> echo "Data has changed!<br>";
>>
>>If either col1 or col2 has been changed the update will fail and
>>mysql_affected_rows() will return zero.
>
>
> This doesn't guarantee it, I admit we're talking mili-, no, microseconds
> here. The problem is queries aren't instantanious, they take time.
>
> 2 Queries run:
> USER1 UPDATE WHERE is searched
> USER2 UPDATE WHERE is searched
> USER1 SETS
> USER2 SETS
>
> So, user 2 has overwritten changes made bu user 1.
>
> Likely no, possible yes.
>
> Grtz,

Actually, it does guarantee it.

During the update the row is locked so it can't be changed. This has been true
in MySQL for many releases.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация