Re: Weird SQL Problem
От | David |
---|---|
Тема | Re: Weird SQL Problem |
Дата | |
Msg-id | 20050908020119.GA2803@localhost.localdomain обсуждение исходный текст |
Ответ на | Weird SQL Problem (<operationsengineer1@yahoo.com>) |
Список | pgsql-novice |
On Wed, Sep 07, 2005 at 04:48:36PM -0700, operationsengineer1@yahoo.com wrote: > hi all, > > i'm baffled by a sql issue. > > i use adodb and the code is as follows (the sql should > be pretty evident - even if you don't follow adodb). > > $result_update = $db->Execute('UPDATE t_defect SET > reworker_id = ' . $reworker_id . ', rework_completed = > \'t\', rework_notes = ' . $rework_notes . ', > rework_date = '. $db->DBDate(time()) . 'WHERE > t_defect.defect_id = ' . $defect_id ); > > my problem is this... the text input for > $rework_notes kicks out a pgsql error as follows... > > 'ERROR: column "aaaaaaaaaaaaaa" does not exist' As Josh Berkus replied, it's a quoting issue. I _think_ this is what you might need (untested) $result_update = $db->Execute('UPDATE t_defect SET reworker_id = ' . $reworker_id . ', rework_completed = \'t\', rework_notes = \'' . $rework_notes . '\', rework_date = '. $db->DBDate(time()) . 'WHERE t_defect.defect_id = ' . $defect_id ); And the same for rework_date and/or t_defect.defect_id if either should be a string. One idea.. if this is in php, or a language that allows the use of either single or double quotes for strings, I think I'd quote the query string here with double quotes. That would make it much easier to catch the missing single quotes that should appear in the query (and avoid the need to escape the single quotes.
В списке pgsql-novice по дате отправления: