Re: MySQL - Problem with multiple INSERTs?
| From: | JJeffman | Date: | Mon, 05 Mar 2001 23:20:26 +0000 |
| Subject: | Re: MySQL - Problem with multiple INSERTs? | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-7128@lists.php.net to get a copy of this message | ||
Have you put an echo with mysql_error() after performing each query ?
Jayme.
-----Mensagem Original-----
De: Chris <chris@ooc2000.com>
Para: <php-db@lists.php.net>
Enviada em: segunda-feira, 5 de março de 2001 05:04
Assunto: [PHP-DB] MySQL - Problem with multiple INSERTs?
> Howdy,
>
> I'm getting weird problems trying to INSERT to two different tables, in
> consecutive mysql_queries. Before, I had 3 queries going, and only 2 would
> work at any time. It seemed like it was 'rotating' the bad query - first
> the 1st query would fail (the other two were fine), then I'd empty all my
> tables and refresh, and this time the 2nd query was the problem, and if I
> did it again the 3rd was. All queries worked fine in phpMyAdmin, both
> individually and when executed en masse.
>
> I've boiled it down to just two queries that don't work. I've included
> everything below (including table schemata), to enable reproduction. It
> seems like a bug to me - the question is, is the bug in PHP, MySQL, or my
> brain?
>
> This is driving me CRAZY!!!!!!!!!!!!
> - Chris
>
> mysql_connect("localhost", "myusername", "mypassword");
> mysql_db_query("DocCountry", "INSERT INTO projects (idCreator, name,
> comment) VALUES (1, 'sysmsg9.txt', 'Some file')");
> mysql_db_query("DocCountry", "INSERT INTO files (idProject, name, comment)
> VALUES (1, 'sysmsg9.txt', 'Some file')");
>
> CREATE TABLE projects ( id int(11) NOT NULL auto_increment, timestamp
> timestamp(14), idCreator int(11) DEFAULT '0' NOT NULL, name varchar(80)
NOT
> NULL, comment text NOT NULL, authLevel varchar(32) NOT NULL, PRIMARY KEY
> (id) );
>
> CREATE TABLE files ( id tinyint(4) NOT NULL auto_increment, idProject
> tinyint(4) DEFAULT '0' NOT NULL, name tinyint(4) DEFAULT '0' NOT NULL,
> comment text NOT NULL, PRIMARY KEY (id) );
>
> (P.S. I've tried things like using SET syntax, using mysql_query instead
of
> mysql_db_query, etc. Nothing helps.)