Let me try and explain a little better:
 
Here is some query code
 
$query3 = "LOCK TABLES COUNTER_PAGE_VIEWS";
$query = "SELECT Count FROM COUNTER_Page_Views WHERE Counter_ID = '" .
$count_id . "'";
$query1 = "UPDATE COUNTER_Page_Views SET Count = Count + 1 WHERE
Counter_ID = '" . $count_id . "'";
$result3 = mysql_query($query3);
$result1 = mysql_query($query1);
$result = mysql_query($query);
 
 
As the page processes, it processes in order, so it owuld go through
those lines of code and do what it needs to do. Currently two users can
cause a threading issue where even if I lock the table, because the call
is not coming from inside MySQL. So the locking only occurs for the
single Query which locks the Table, then the next query execution voids
the write lock on the table.
 
What I would need to do here is either lump all the queryioes into one
SQL execution or lock the PHP code so it is single threaded like this:
 
$query3 = "LOCK TABLES COUNTER_PAGE_VIEWS";
$query = "SELECT Count FROM COUNTER_Page_Views WHERE Counter_ID = '" .
$count_id . "'";
$query1 = "UPDATE COUNTER_Page_Views SET Count = Count + 1 WHERE
Counter_ID = '" . $count_id . "'";

<LOCK THE CODE SO ONLY ONE CLIENT CAN RUN AT A TIME>
$result3 = mysql_query($query3);
$result1 = mysql_query($query1);
$result = mysql_query($query);
<RELEASE THE LOCK>
 
Anyone have any suggestions?
 
Matt Babineau
Freelance Internet Developer
e:  <mailto:[EMAIL PROTECTED]>
[EMAIL PROTECTED] 
p: 603.943.4237
w:  <http://www.illuminatistudios.com/> http://www.illuminatistudios.com
 
 

Reply via email to