Sorry for seeming a bit dense, but what's the problem
with using "LOCL TABLES" for all SQL stmnts?

It's my understanding that it will lock tables
and prevent other procs from reading/writing to
that table while you've got a lock on it.

Is that not the case?

---
Scott Hurring
Systems Programmer
EAC Corporation
[EMAIL PROTECTED]
Voice: 201-462-2149
Fax: 201-288-1515

> -----Original Message-----
> From: Matt Babineau [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, April 25, 2002 3:46 PM
> To: 'Php-Win (E-mail)'
> Subject: [PHP-WIN] MySQL / PHP - possible to run many sql 
> statements in
> the same execution?
> 
> 
> 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
 
 

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to