note 32275 added to function.mysql-db-query
| From: | yaroukh at email dot cz | Date: | Thu, 22 May 2003 11:18:37 +0000 |
| Subject: | note 32275 added to function.mysql-db-query | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-48810@lists.php.net to get a copy of this message | ||
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.
----
Manual Page -- http://www.php.net/manual/en/function.mysql-db-query.php
Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+32275
Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+32275&report=yes
Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+32275&report=yes