Addressed to: Chris <[EMAIL PROTECTED]>
              [EMAIL PROTECTED]

** Reply to note from Chris <[EMAIL PROTECTED]> Mon, 05 Mar 2001 02:04:28 -0600

The first thing that jumps out is using tinyint for keys.  Are you sure
there will never be more than 127 entries in the table?

I usually use bigint for all my auto_increment keys.  Not so much
because I expect to use that many entries in the table, as because a
bigint is almost big enough that it provides enough space for the delete
chain marker used in myisam files.

Once upon a time I did a DELTE FROM table and regretted it.  I happened
to have used two bigint fields as the first fields of the table, and was
able to recover the data by looking into the table files with a hex
editor.  It was not fun, but it worked because the delete chain MySQL
puts at the front of a deleted record was smaller than the two bigints.
All the text data that I needed was still there.  Since them it is my
policy to place a bigint primary key as the first entry every table
where it is apropriate.

> 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.)

Rick Widmer
Internet Marketing Specialists

PHP Database Mailing List (
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