NYCPHP Meetup

NYPHP.org

[nycphp-talk] inserting data into MySQL table.

csnyder chsnyder at gmail.com
Mon Jul 23 14:04:40 EDT 2007


On 7/23/07, Jon Baer <jonbaer at jonbaer.com> wrote:
> Id guess that one of your data types (or more) is still not valid for
> the type declared but ~not sure if you know this~ but you can add
> column names before your query ...
>
> INSERT INTO my_table (col1_name, col2_name) VALUES (col1_value,
> col2_value) // Try a few values up until you error out
>

I find it even less confusing to use the SET variant that makes
INSERTs look like UPDATEs:

INSERT INTO my_table SET col1_name=col1_value, col2_name=col2_value;


-- 
Chris Snyder
http://chxo.com/



More information about the talk mailing list