RE: INSERT question...

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

 



	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.

-----Original Message-----
From: Aaron Wolski [mailto:aaronjw@martekbiz.com]
Sent: Wednesday, November 20, 2002 1:28 PM
To: '1LT John W. Holmes'; NIPP, SCOTT V (SBCSI); php-db@lists.php.net
Subject: RE:  INSERT question...


Hmm


You learn something new everyday :)

Aaron

-----Original Message-----
From: 1LT John W. Holmes [mailto:holmes072000@charter.net] 
Sent: November 20, 2002 2:27 PM
To: Aaron Wolski; 'NIPP, SCOTT V (SBCSI)'; php-db@lists.php.net
Subject: Re:  INSERT question...

> Try... $query = "INSERT INTO accounts (accnts,timestamp)
> VALUES(''.$accnts[0].'','TIMESTAMP(10)')";
>
> Might work?
>
> Aaron
>

For the OP, you don't really want to insert the text TIMESTAMP(10) into
a
column, do you? If you want the current 10-digit timestamp, then you can
just use NOW() or CURRENT_DATE, so long as your column is declared with
a
width of 10. In fact, if it's a timestamp, you don't need to do
anything,
it'll be updated with the current time upon insert. so you could
probably
just do this:

$query = "INSERT INTO accounts (accnts) VALUES (".$accnts[0].")";

---John Holmes...

>
> -----Original Message-----
> From: NIPP, SCOTT V (SBCSI) [mailto:sn4265@sbc.com]
> Sent: November 20, 2002 2:16 PM
> To: 'php-db@lists.php.net'
> Subject:  INSERT question...
>
> I have an INSERT statement that I cannot quiet get working.  The
> table that this data is being put into has 7 columns, but I only care
> about
> putting in the data from the first two columns at this time.  The
first
> column is an array element, and the second column needs to be a
> timestamp.
> Here is the INSERT statement:
>
> $query = "INSERT INTO accounts VALUES('".$accnts[0]."',
'TIMESTAMP(10)',
> , ,
> , ,)";
>
> Here is the error being displayed on the web page:
>
> You have an error in your SQL syntax near ' , , ,)' at line 1
> Thanks in advance for the help.
>
> Scott Nipp
> Phone:  (214) 858-1289
> E-mail:  sn4265@sbc.com
> Web:  http:\\ldsa.sbcld.sbc.com
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>



-- 
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