RE: [PHP-DB] Update Query Help...
| From: | Ford, Mike [LSS] | Date: | Wed, 11 Dec 2002 11:35:56 +0000 |
| Subject: | RE: [PHP-DB] Update Query Help... | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-24057@lists.php.net to get a copy of this message | ||
> -----Original Message-----
> From: NIPP, SCOTT V (SBCSI) [mailto:sn4265@sbc.com]
> Sent: 10 December 2002 20:02
>
> I have definitely isolated the problem. If I change
> the column name
> that the match is being performed on from 'id-sys' to
> 'id_sys' I can execute
> the query without having to worry about quoting the column name and
> everything works. I think that I am just going to leave the
> column name
> changed and take this as a lesson never to use '-' in a
> column name again.
Well, if you stop to think about this for a second, it may occur to you to wonder how MySQL is
supposed to tell the difference between the column name id-sys, and the expression id-sys (i.e. the
value of the id column minus the value of the sys column). The answer is that you have to demarcate
a column name like this that is ambiguous -- and in MySQL that's with ` back ticks. (Other
databases have other means of doing this -- or just restrict column names to avoid the issue!)
Cheers!
Mike
---------------------------------------------------------------------
Mike Ford, Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS, LS6 3QS, United Kingdom
Email: m.ford@lmu.ac.uk
Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211