Re: INSERT question...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Quoting "1LT John W. Holmes" <holmes072000@charter.net>:

> > OK.  This sounds great, but now I am getting a completely different
> > error message.
> >
> > You have an error in your SQL syntax near '-sys) VALUES('sn4265-turner')'
> at
> > line 1
> >
> > Here is the INSERT statement:
> >
> > $query = "INSERT INTO accounts (id-sys) VALUES('".$accnts[0]."')";
> >
> > Do I have to rename the column?  I would rather not if I can avoid
> > it.  If I must, is this a problem with PHP or MySQL not understanding '-'
> in
> > a column name?  Thanks again.
> 
> Try putting backtics (not single quotes) around the column name.
> 
> $query = "INSERT INTO accounts (`id-sys`) VALUES ('".$accnts[0]."')";
> 
> if that don't work, you'll have to rename the column.

Are backtics the same for MYSQL that brackets are for other dbs?  I would use
[id-sys], but then again i'm stuck with MS-SQL.
-- 
Ryan T. Gallagher




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux