note 32275 deleted from function.mysql-db-query by aidan
| From: | aidan@php.net | Date: | Sun, 02 Oct 2005 13:02:29 +0000 |
| Subject: | note 32275 deleted from function.mysql-db-query by aidan | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-96163@lists.php.net to get a copy of this message | ||
Note Submitter: yaroukh at email dot cz
----
MySQL_Db_Query vs. MySQL_Query - MySQL replication pitfall
I'm updating two MySQL db's - "web" and "stats", these two databases
are being replicated. I was wondering that the replication worked when sending queries from a
console but with queries from a script it did't ...
the wrong way:
MySQL_Query("UPDATE web.users SET ..... WHERE id = 11444", $writeConnection);
the proper way:
MySQL_Db_Query("web", "UPDATE users SET ..... WHERE id = 11444",
$writeConnection);
The catch is that only queries written from within a replicated db are being sent to be replicated -
when you send a query without "USE <REPLICATED_DB>" (or the
MySQL_Db_Query("<REPLICATED_DB>", ...);) the query won't be replicated - even
if it "points" to a replicated db (e.g. "UPDATE <REPLICATED_DB>.table
...".
At least this is how it seems to work for me. :o)
Maybe this would help to someone.