RE: Datetime help in an INSERT...

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

 



1. Change your field name from date to something like datefield (or backtick
it)

2. Place single quotes within your VALUES parens, e.g. 

$denylog = "INSERT INTO deny (account, td, datefield ) VALUES ('$tmp',
'$td', NOW() )"

Gary Every
Sr. UNIX Administrator
Ingram Entertainment
(615) 287-4876
"Pay It Forward"
mailto:gary.every@ingramentertainment.com
http://accessingram.com


> -----Original Message-----
> From: NIPP, SCOTT V (SBCSI) [mailto:sn4265@sbc.com]
> Sent: Wednesday, June 04, 2003 2:06 PM
> To: 'Rankin, Randy'; 'php-db@lists.php.net'
> Subject: RE:  Datetime help in an INSERT...
> 
> 
> 	No, the field is a Datetime field rather than a Timestamp field.
> 
> -----Original Message-----
> From: Rankin, Randy [mailto:randy.rankin@invensys.com]
> Sent: Wednesday, June 04, 2003 1:59 PM
> To: 'php-db@lists.php.net'
> Subject: RE:  Datetime help in an INSERT...
> 
> 
> Correction ( I typed this in a hurry ) ...
> 
> If you are using MySql and the date field is of type 
> timestamp, you should
> _not_
> have to insert anything using the query. It will update 
> automatically when
> the record is inserted and/or updated.
> 
> ie; $denylog = "INSERT INTO deny (account, td ) VALUES ($tmp, $td )";
> 
> Randy
> 
> -----Original Message-----
> From: Rankin, Randy [mailto:randy.rankin@invensys.com]
> Sent: Wednesday, June 04, 2003 1:56 PM
> To: 'php-db@lists.php.net'
> Subject: RE:  Datetime help in an INSERT...
> 
> 
> If you are using MySql with the date field is of type 
> timestamp, you should
> have to insert anything using the query. It will update 
> automatically when
> the record is inserted and/or updated.
> 
> ie; $denylog = "INSERT INTO deny (account, td ) VALUES ($tmp, $td )";
> 
> Randy
> 
> -----Original Message-----
> From: NIPP, SCOTT V (SBCSI) [mailto:sn4265@sbc.com]
> Sent: Wednesday, June 04, 2003 1:47 PM
> To: 'jay@advmed.com'
> Cc: 'php-db@lists.php.net'
> Subject: RE:  Datetime help in an INSERT...
> 
> 
> 	The error I am receiving is:
> 
> You have an error in your SQL syntax near ' NOW())' at line 1
> 
> -----Original Message-----
> From: jay@advmed.com [mailto:jay@advmed.com]
> Sent: Wednesday, June 04, 2003 1:45 PM
> To: NIPP, SCOTT V (SBCSI)
> Subject: Re:  Datetime help in an INSERT...
> 
> 
> what kind of error are you getting?
> 
> > 	I am stumbling across something that I thought I have 
> done before,
> > and I am not having any luck finding an example of this.  
> Basically, I am
> > wanting to timestamp the date and time into new entries in a simple
> database
> > table.  The following section is the actual code for this, 
> and I cannot
> > figure out how to get the date/time stamp to populate into 
> the database.
> > Thanks in advance for the help.  I suspect this is a very 
> simple fix.
> > 
> > $denylog = "INSERT INTO deny (account, td, date) VALUES ($tmp, $td,
> NOW())";
> > $denylog_result = mysql_query($denylog, $Prod) or 
> die(mysql_error());
> > 
> > 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