Re: auto_increment value increased from 20 to 32 when I inserted a new row.

2011-09-19 Thread Johan De Meersman
- Original Message - > From: "crocket" > > I had 19 rows in series table. And when I tried inserting the 20th > row, the auto_increment value suddenly increased from 20 to 32, and > the new row has 20 as series_id. The first thing that comes to mind, is transactions that insert, but then

auto_increment value increased from 20 to 32 when I inserted a new row.

2011-09-19 Thread crocket
Below is the definition of the table with the problem. CREATE TABLE `series` ( `series_id` int(10) unsigned NOT NULL AUTO_INCREMENT, `title` varchar(200) NOT NULL, PRIMARY KEY (`series_id`) ) ENGINE=InnoDB I had 19 rows in series table. And when I tried inserting the 20th row, the auto_incr

Re: Quotes around INSERT and SELECT statements' arguments from the mysql CLI and PHP

2011-09-19 Thread Reindl Harald
Am 20.09.2011 01:23, schrieb Dotan Cohen: > On Tue, Sep 20, 2011 at 01:48, Reindl Harald wrote: >> i would use a samll class holding the db-connection with >> insert/update-methods >> pass the whole record-array, lokk what field types are used in the table >> and use intval(), doubleval() or my

Re: Quotes around INSERT and SELECT statements' arguments from the mysql CLI and PHP

2011-09-19 Thread Dotan Cohen
On Tue, Sep 20, 2011 at 01:48, Reindl Harald wrote: > i would use a samll class holding the db-connection with insert/update-methods > pass the whole record-array, lokk what field types are used in the table > and use intval(), doubleval() or mysql_real_escape-String > By the way, the database co

Re: Quotes around INSERT and SELECT statements' arguments from the mysql CLI and PHP

2011-09-19 Thread Dotan Cohen
On Tue, Sep 20, 2011 at 01:48, Reindl Harald wrote: > i would use a samll class holding the db-connection with insert/update-methods > pass the whole record-array, lokk what field types are used in the table > and use intval(), doubleval() or mysql_real_escape-String > > so you never write "insert

Re: Quotes around INSERT and SELECT statements' arguments from the mysql CLI and PHP

2011-09-19 Thread Dotan Cohen
On Tue, Sep 20, 2011 at 02:09, Hank wrote: >> >> I want to be sure that all variables in the query are escaped. I don't >> trust myself or anyone else to do this to every variable right before >> the query: >> $someVar=mysql_real_escape_string($someVar); >> > > But you're doing exactly that right

Re: Quotes around INSERT and SELECT statements' arguments from the mysql CLI and PHP

2011-09-19 Thread Hank
> > > I want to be sure that all variables in the query are escaped. I don't > trust myself or anyone else to do this to every variable right before > the query: > $someVar=mysql_real_escape_string($someVar); > > But you're doing exactly that right before the query anyway with: $M[username]=mysql_

Re: Quotes around INSERT and SELECT statements' arguments from the mysql CLI and PHP

2011-09-19 Thread Reindl Harald
Am 20.09.2011 00:39, schrieb Dotan Cohen: > On Tue, Sep 20, 2011 at 01:11, Hank wrote: >> Best of both worlds: >>> $username=$_POST['username']; >>> // do some stuff with username here >>> $M=array(); // Array of things to be inserted into MySQL >>> $M[username]=mysql_real_escape_string($userna

Re: Quotes around INSERT and SELECT statements' arguments from the mysql CLI and PHP

2011-09-19 Thread Dotan Cohen
On Tue, Sep 20, 2011 at 01:11, Hank wrote: > Best of both worlds: >> $username=$_POST['username']; >> // do some stuff with username here >> $M=array();  // Array of things to be inserted into MySQL >> $M[username]=mysql_real_escape_string($username); // Everything that >> goes into $M is escaped

Re: Quotes around INSERT and SELECT statements' arguments from the mysql CLI and PHP

2011-09-19 Thread Hank
Best of both worlds: > $username=$_POST['username']; > // do some stuff with username here > $M=array(); // Array of things to be inserted into MySQL > $M[username]=mysql_real_escape_string($username); // Everything that > goes into $M is escaped > $query="INSERT INTO table (username) VALUES ('{$M

MySQL Database Server 5.1.59 has been released

2011-09-19 Thread Karen Langford
Dear MySQL users, MySQL Server 5.1.59, a new version of the popular Open Source Database Management System, has been released. MySQL 5.1.59 is recommended for use on production systems. For an overview of what's new in MySQL 5.1, please see http://dev.mysql.com/doc/refman/5.1/en/mysql-nutshel

Re: Quotes around INSERT and SELECT statements' arguments from the mysql CLI and PHP

2011-09-19 Thread Dotan Cohen
On Mon, Sep 19, 2011 at 18:11, Reindl Harald wrote: > it is not because it is clear that it is sanitized instead hope and pray > thousands of layers somewhere else did it - for a inline-query the best > solution, if you are using a framework you will never have the "insert into" > at this place! >

Re: myisamchk error (duplicate key records)

2011-09-19 Thread Johan De Meersman
- Original Message - > From: "Hank" > > I'm trying to rebuild an index after disabling all keys using > myisamchk and adding all 144 million records, so there is no current index on > the > table. Ahhh... I didn't realise that. > But in order to create the index, mysql has to do a fu

Re: table design question

2011-09-19 Thread Richard Reina
Thank you very much for all the insightful advice. I will keep the separated. 2011/9/19 Jerry Schwartz > >-Original Message- > >From: Richard Reina [mailto:gatorre...@gmail.com] > >Sent: Monday, September 19, 2011 9:55 AM > >To: mysql@lists.mysql.com > >Subject: table design question > >

Re: Quotes around INSERT and SELECT statements' arguments from the mysql CLI and PHP

2011-09-19 Thread Reindl Harald
Am 19.09.2011 16:55, schrieb Hank: >> >> what ugly style - if it is not numeric and you throw it to the database >> you are one of the many with a sql-injection because if you are get >> ivalid values until there you have done no sanitize before and do not here >> >> > It's a matter of opinion.

Re: table design question

2011-09-19 Thread Johnny Withers
I would design three tables: Table1 (states): ID, name, abbreviation Table2 (state_item): ID, state_id (from states), item_id (from item_type), item_value (varchar) Table3 (item_type): ID, item_name Into the item_type table you can insert: Nick Name Motto Name origin Facts SomeOtherDataPoint S

Re: Quotes around INSERT and SELECT statements' arguments from the mysql CLI and PHP

2011-09-19 Thread Hank
> > what ugly style - if it is not numeric and you throw it to the database > you are one of the many with a sql-injection because if you are get > ivalid values until there you have done no sanitize before and do not here > > It's a matter of opinion. I never said the data wasn't sanitized (it is

Re: myisamchk error (duplicate key records)

2011-09-19 Thread Hank
> > > Exactly - I can't create an index on the table until I remove the > > duplicate records. > > I was under the impression you were seeing this during a myisamchk run - > which indicates you should *already* have a key on that field. Or am I > interpreting that wrong? > > I'm trying to rebuild a

RE: table design question

2011-09-19 Thread Jerry Schwartz
>-Original Message- >From: Richard Reina [mailto:gatorre...@gmail.com] >Sent: Monday, September 19, 2011 9:55 AM >To: mysql@lists.mysql.com >Subject: table design question > >I want to create a US geography database. So far I have categories such as >state nick names (some states have more

table design question

2011-09-19 Thread Richard Reina
I want to create a US geography database. So far I have categories such as state nick names (some states have more than one), state mottos (text 25 to 150 characters), state name origins (100-300 characters), state "trivial facts", entry into union. My question is; would it be better to keep at le

Re: myisamchk error (duplicate key records)

2011-09-19 Thread Johan De Meersman
- Original Message - > From: "Hank" > > Exactly - I can't create an index on the table until I remove the > duplicate records. I was under the impression you were seeing this during a myisamchk run - which indicates you should *already* have a key on that field. Or am I interpreting t

Re: myisamchk error (duplicate key records)

2011-09-19 Thread Hank
On Mon, Sep 19, 2011 at 7:19 AM, Johan De Meersman wrote: > - Original Message - > > From: "Hank" > > > > While running a -rq on a large table, I got the following error: > > > > myisamchk: warning: Duplicate key for record at 54381140 against > > record at 54380810 > > > > How do I f

Re: myisamchk error (duplicate key records)

2011-09-19 Thread Johan De Meersman
- Original Message - > From: "Hank" > > While running a -rq on a large table, I got the following error: > > myisamchk: warning: Duplicate key for record at 54381140 against > record at 54380810 > > How do I find which records are duplicated (without doing the typical > self-join o

Re: Quotes around INSERT and SELECT statements' arguments from the mysql CLI and PHP

2011-09-19 Thread Dotan Cohen
On Mon, Sep 19, 2011 at 07:47, Reindl Harald wrote: > what ugly style - if it is not numeric and you throw it to the database > you are one of the many with a sql-injection because if you are get > ivalid values until there you have done no sanitize before and do not here > > $sql="INSERT into tab