drooh

msg:4331054 | 6:37 pm on Jun 25, 2011 (gmt 0) |
Or vise versa, is there a way to $sql = "INSERT INTO `test` (`name`='sam',`age`='34')";
|
coopster

msg:4335372 | 8:10 pm on Jul 5, 2011 (gmt 0) |
Have you checked the optional syntax? [dev.mysql.com...]
|
drooh

msg:4335390 | 8:51 pm on Jul 5, 2011 (gmt 0) |
not really seeing an answer there? Can you specify some code or be more specific?
|
coopster

msg:4335396 | 9:06 pm on Jul 5, 2011 (gmt 0) |
Second syntax example is almost exactly what you typed in your second post ... INSERT INTO test SET name = 'sam', age = 34;
|
drooh

msg:4335413 | 9:35 pm on Jul 5, 2011 (gmt 0) |
Ok, thank you, I wish they could write their examples like that. For some reason that mysql website is just so hard for me to read. Somehow INSERT [LOW_PRIORITY | DELAYED | HIGH_PRIORITY] [IGNORE] [INTO] tbl_name SET col_name={expr | DEFAULT}, ... [ ON DUPLICATE KEY UPDATE col_name=expr [, col_name=expr] ... ] Just doesnt register in my brain. thanks for you post and letting me know this is possible.
|
drooh

msg:4335446 | 11:04 pm on Jul 5, 2011 (gmt 0) |
This was exactly what I was looking for, this way I can re-use a portion of the query for inserting and updating. Just out of curiosity at this point, is there a way to do something like this? $sql = "UPDATE `test` SET ( `name`, `age` ) VALUES ( 'Pete', '34' ) WHERE `id` = 10 ";
|
coopster

msg:4336321 | 12:32 pm on Jul 7, 2011 (gmt 0) |
not according to the syntax ... [dev.mysql.com...] Regarding reading the manuals and understanding the syntax ... [dev.mysql.com...]
|
|