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

2011-09-18 Thread Dotan Cohen
On Mon, Sep 19, 2011 at 04:00, Hank 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 PHP and a n

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

2011-09-18 Thread Reindl Harald
Am 19.09.2011 03:00, schrieb Hank: > 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 PHP and a numeri

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

2011-09-18 Thread Hank
On Sun, Sep 18, 2011 at 12:28 PM, Dotan Cohen wrote: > On Sun, Sep 18, 2011 at 17:44, Brandon Phelps wrote: > > Personally I don't use any quotes for the numeric types, and single > quotes > > for everything else. Ie: > > > > Thanks, Brandon. I understand then that quote type is a matter of > t

myisamchk error (duplicate key records)

2011-09-18 Thread 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 or "having cnt(*)>1" query)? This table has 144 million rows,

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

2011-09-18 Thread Dotan Cohen
On Sun, Sep 18, 2011 at 17:44, Brandon Phelps wrote: > Personally I don't use any quotes for the numeric types, and single quotes > for everything else.  Ie: > Thanks, Brandon. I understand then that quote type is a matter of taste. I always use double quotes in PHP and I've only recently started

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

2011-09-18 Thread Brandon Phelps
Personally I don't use any quotes for the numeric types, and single quotes for everything else. Ie: UPDATE mytable SET int_field = 5 WHERE id = 3; SELECT id FROM mytable WHERE int_field = 5; UPDATE mytable SET varchar_field = 'Test' WHERE id = 3; SELECT id FROM mytable WHERE varchar_field = 'Te