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 04:00, Hank hes...@gmail.com wrote: I agree with Brandon's suggestions, I would just add when using numeric types in PHP statements where you have a variable replacement, for instance: $sql=INSERT into table VALUES ('$id','$val'); where $id is a numeric variable in

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 h.rei...@thelounge.net 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

Re: myisamchk error (duplicate key records)

2011-09-19 Thread Johan De Meersman
- Original Message - From: Hank hes...@gmail.com 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

Re: myisamchk error (duplicate key records)

2011-09-19 Thread Hank
On Mon, Sep 19, 2011 at 7:19 AM, Johan De Meersman vegiv...@tuxera.bewrote: - Original Message - From: Hank hes...@gmail.com While running a -rq on a large table, I got the following error: myisamchk: warning: Duplicate key for record at 54381140 against record at

Re: myisamchk error (duplicate key records)

2011-09-19 Thread Johan De Meersman
- Original Message - From: Hank hes...@gmail.com 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

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

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 than

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 an index

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: 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

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. I never said

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 je...@gii.co.jp -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

Re: myisamchk error (duplicate key records)

2011-09-19 Thread Johan De Meersman
- Original Message - From: Hank hes...@gmail.com 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

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 h.rei...@thelounge.net 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

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

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

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 hes...@gmail.com 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

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 hes...@gmail.com wrote: Best of both worlds: $username=$_POST['username']; // do some stuff with username here $M=array(); // Array of things to be inserted into MySQL

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:

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 hes...@gmail.com 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

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 h.rei...@thelounge.net 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

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 h.rei...@thelounge.net 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

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 h.rei...@thelounge.net 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(),

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