Have you put an echo with mysql_error() after performing each query ?


-----Mensagem Original-----
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)
> 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
> mysql_db_query, etc. Nothing helps.)

PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to