Welcome Guest ( Log In | Register)



 
Reply to this topicStart new topic
> Concurrency Problem?, update together in the same time
.hack//GU
post May 26 2008, 09:09 AM
Post #1


Premium Member
********

Group: Members
Posts: 190
Joined: 21-October 05
Member No.: 13,185



I have a problem in PHP.
When more than one client update something in database, they won't work.

so, how do I make out for it?

example:
at the same time, in real-time chatboard, 2 persons click CHAT, what can I do so that both of them actually chat?
or at bidding website, when 2 persons bid at same time, how could I do that?

thanks for answer.
Go to the top of the page
 
+Quote Post
urtrivedi
post May 26 2008, 11:29 AM
Post #2


Newbie
*

Group: Members
Posts: 2
Joined: 26-May 08
Member No.: 62,676



Actually You can build Transactions before update or inserting data into database. also don't work with out proper primary and foreign keys in you tables.
Try to use autogenerate option for primary keys.

I suppose you are using mysql database,
I dont know about mysql transactions, but I use oracle 10g.

If I have to execute set of 2 query in the manner that 2 should succeed or no query should execute.
CODE
$query1="some insert";

$statement1 = oci_parse($connection, $query1);
if ((oci_execute($statement1,OCI_DEFAULT)))
{

[indent]     $query2="some more insert";
     $statement2 = oci_parse($connection, $query2);
     if ((oci_execute($statement2,OCI_DEFAULT)))
    [indent]           oci_commit($connection));   [/indent]
    
     else
[indent]              oci_rollback($connection));  [/indent]
[/indent]
}
else
{
              oci_rollback($connection))  ;
}


You please specify what problem exactly you are facing. Why you feel that you data is not concurrent.

Notice from rvalkass:

Code needs to go inside Code BBTags.
List of BBCodes


This post has been edited by rvalkass: May 26 2008, 01:54 PM
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. Mysql Won't Update(4)
  2. Sending E-mails After News Update?(8)


 



- Lo-Fi Version Time is now: 8th September 2008 - 05:50 AM