Hi to all.
I have a table with 13g record, and they're 20 user selecting record from that specific table.
Some time when they are selecting record, the same record appear in 2,3,4,5 user at the same time.
I neet something that when a record is select it for one user could not be select from other at the same time, but with giving lock record or any thing like that.
there is something in the select-sql that could prevent this to happens?
this is my sql-selete command:
$result = mysql_query("SELECT * FROM customer WHERE isnewclient='NL' and iduser='') ", $link);
immediately i update the record:
$phone_number=$row[1];
$result = mysql_query("UPDATE customer SET iduser='$username' WHERE phone_number='$phone_number'") or die(mysql_error());
but any way more than 1 people is getting duplicate
thanks in advance
Select only on record?
Moderator: General Moderators
Re: Select only on record?
Bit hard to understand you but if I'm understanding correctly:
You're wanting to select a record for 1 user only, but its bringing up records from other users as well ?
You're wanting to select a record for 1 user only, but its bringing up records from other users as well ?
Re: Select only on record?
I have 20 user in different computer, all of then accessing the same database.
Every things is OK, but once a while 2 or more user get the same record in they're screen, i need to avoid that one record from db appear in more than 1 user.
I have try select for update but when i try to update all user freeze.
Every things is OK, but once a while 2 or more user get the same record in they're screen, i need to avoid that one record from db appear in more than 1 user.
I have try select for update but when i try to update all user freeze.
Re: Select only on record?
You can find information about locking mechanism and strategies here for Innodb:gertrudis wrote:I have 20 user in different computer, all of then accessing the same database.
Every things is OK, but once a while 2 or more user get the same record in they're screen, i need to avoid that one record from db appear in more than 1 user.
I have try select for update but when i try to update all user freeze.
http://dev.mysql.com/doc/refman/5.0/en/ ... s-set.html
and here:
http://dev.mysql.com/doc/refman/5.0/en/ ... modes.html
your final goal (don't allow the user to see records being seeing or used for others users) is highly unusual in database concepts and implementation
Re: Select only on record?
thanks a lot mikosiko
Change table engine to innodb works.
Change table engine to innodb works.