Great.  That is perfect.  The last minor issue is that the timestamp
is a datetime column, and needs to be such since I don't want this to change
when the record is updated.  This is correct, right?  If the column were a
timestamp data type, the value would change every time the record is
updated?  I am trying:

 $query = "INSERT INTO accounts (`id-sys`, rtime) VALUES('".$accnts[0]."',

        This is entering the array element properly, but not the time.  The
datetime field is coming up with all zeroes.

-----Original Message-----
From: 1LT John W. Holmes [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, November 20, 2002 2:21 PM
Subject: Re: [PHP-DB] INSERT question...

> 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')'
> 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 '-'
> 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.

---John Holmes...

PHP Database Mailing List (
To unsubscribe, visit:

Reply via email to