RE: [PHP-DB] Datetime help in an INSERT...

2003-06-06 Thread NIPP, SCOTT V (SBCSI)
I have actually discovered that the $td value is blank.  The reason
appears to be that the page is reloading when a button is pushed, and that
is when the $td value is being lost.  My question now is, how do I keep the
$td value after the page is reloaded?  I would rather keep the value from
the original query than perform another database query to populate this
value yet again.  Thanks yet again for the help.

-Original Message-
From: CPT John W. Holmes [mailto:[EMAIL PROTECTED]
Sent: Wednesday, June 04, 2003 2:14 PM
To: NIPP, SCOTT V (SBCSI); [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Datetime help in an INSERT...


  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());

 The error I am receiving is:

 You have an error in your SQL syntax near ' NOW())' at line 1

Are you sure $td has a value? If it's blank, you'd get an error like that.

---John Holmes...

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



Re: [PHP-DB] Datetime help in an INSERT...

2003-06-06 Thread CPT John W. Holmes
 I have actually discovered that the $td value is blank.  The reason
 appears to be that the page is reloading when a button is pushed, and that
 is when the $td value is being lost.  My question now is, how do I keep
the
 $td value after the page is reloaded?  I would rather keep the value from
 the original query than perform another database query to populate this
 value yet again.  Thanks yet again for the help.

Stick it in the session? cookie? URL? What is $td?

---John Holmes...


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



RE: [PHP-DB] Datetime help in an INSERT...

2003-06-06 Thread NIPP, SCOTT V (SBCSI)
OK.  I guess the next question would be what is the best option for
performance?  This portion of the app currently doesn't have any session
functionality built in.  I would be setting up the session for this sole
purpose.  I haven't worked with cookies yet.  I suppose the URL method might
work, I have just never like it because I think it looks unclean, just
personal preference there.
As to the $td question...  This is a variable that holds the userid
of the Technical Director who is the account approver.  This portion of
the app is simply an approval mechanism to an account request system that I
am developing.  The TD receives an e-mail with a link back to the approval
page to approve the requested accounts.  This approval then fires off an
e-mail to the SA responsible for user accounts to inform him to create the
newly approved account.
Well, thanks again for the feedback.  Hopefully I can get this going
pretty quick.  We are currently planning on rolling this app out to our user
community on Monday.  This is the last issue I have that I am aware of.

-Original Message-
From: CPT John W. Holmes [mailto:[EMAIL PROTECTED]
Sent: Thursday, June 05, 2003 9:06 AM
To: NIPP, SCOTT V (SBCSI); [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Datetime help in an INSERT...


 I have actually discovered that the $td value is blank.  The reason
 appears to be that the page is reloading when a button is pushed, and that
 is when the $td value is being lost.  My question now is, how do I keep
the
 $td value after the page is reloaded?  I would rather keep the value from
 the original query than perform another database query to populate this
 value yet again.  Thanks yet again for the help.

Stick it in the session? cookie? URL? What is $td?

---John Holmes...

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



RE: [PHP-DB] Datetime help in an INSERT...

2003-06-06 Thread NIPP, SCOTT V (SBCSI)
Not sure exactly how I would implement this.  Currently the reload URL
is being provided via the $PHP_SELF variable.  I like using this, but
suppose I could change this if truly necessary.  Also, the $td is not
currently being passed into the function that generates the two buttons and
hence defines the reload URL.  I would rather not pass any additional
variables into this function as I just feel this is unclean.  Thanks again
for the idea, and any additional advice or suggestions are most appreciated.

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]
Sent: Thursday, June 05, 2003 9:01 AM
To: NIPP, SCOTT V (SBCSI)
Subject: RE: [PHP-DB] Datetime help in an INSERT...



You could alway place it as a GET 

echo a href=\yourscript.com/yourpage.php?td=$td\; 


Gary Every 
Sr. UNIX Administrator 
Ingram Entertainment 
(615) 287-4876 
Pay It Forward 
mailto:[EMAIL PROTECTED]
mailto:[EMAIL PROTECTED]  
http://accessingram.com http://accessingram.com  


 -Original Message- 
 From: NIPP, SCOTT V (SBCSI) [ mailto:[EMAIL PROTECTED]
mailto:[EMAIL PROTECTED] ] 
 Sent: Thursday, June 05, 2003 8:57 AM 
 To: 'CPT John W. Holmes'; [EMAIL PROTECTED] 
 Cc: [EMAIL PROTECTED] 
 Subject: RE: [PHP-DB] Datetime help in an INSERT... 
 
 
   I have actually discovered that the $td value is blank. 
  The reason 
 appears to be that the page is reloading when a button is 
 pushed, and that 
 is when the $td value is being lost.  My question now is, how 
 do I keep the 
 $td value after the page is reloaded?  I would rather keep 
 the value from 
 the original query than perform another database query to 
 populate this 
 value yet again.  Thanks yet again for the help. 
 
 -Original Message- 
 From: CPT John W. Holmes [ mailto:[EMAIL PROTECTED]
mailto:[EMAIL PROTECTED] ] 
 Sent: Wednesday, June 04, 2003 2:14 PM 
 To: NIPP, SCOTT V (SBCSI); [EMAIL PROTECTED] 
 Cc: [EMAIL PROTECTED] 
 Subject: Re: [PHP-DB] Datetime help in an INSERT... 
 
 
   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()); 
  
  The error I am receiving is: 
  
  You have an error in your SQL syntax near ' NOW())' at line 1 
 
 Are you sure $td has a value? If it's blank, you'd get an 
 error like that. 
 
 ---John Holmes... 
 
 -- 
 PHP Database Mailing List ( http://www.php.net/ http://www.php.net/ ) 
 To unsubscribe, visit: http://www.php.net/unsub.php
http://www.php.net/unsub.php  
 



RE: [PHP-DB] Datetime help in an INSERT...

2003-06-06 Thread NIPP, SCOTT V (SBCSI)
I just responded to a separate but similar suggestion.  The form
elements, including the buttons, are all generated in a separate function.
I am currently passing about 5 variables into this function and I am a
little hesitant to pass any others.  I am not sure about complexity,
performance, etc. in passing so many variables into a function.  Please let
me know if anyone has any ideas on this.  I doubt that this is happening,
but I would really like for the code to be as easily maintainable as
possible.

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Thursday, June 05, 2003 9:48 AM
To: NIPP, SCOTT V (SBCSI)
Subject: RE: [PHP-DB] Datetime help in an INSERT...


a button is being pressed?
so it is processing a form?
if its in a form just pass along the value of $td via hidden input data...

input type=hidden name=td value=? echo $td; ?

jay merritt
[EMAIL PROTECTED]
[EMAIL PROTECTED]


   OK.  I guess the next question would be what is the best option for
 performance?  This portion of the app currently doesn't have any session
 functionality built in.  I would be setting up the session for this sole
 purpose.  I haven't worked with cookies yet.  I suppose the URL method
might
 work, I have just never like it because I think it looks unclean, just
 personal preference there.
   As to the $td question...  This is a variable that holds the userid
 of the Technical Director who is the account approver.  This portion of
 the app is simply an approval mechanism to an account request system that
I
 am developing.  The TD receives an e-mail with a link back to the
approval
 page to approve the requested accounts.  This approval then fires off an
 e-mail to the SA responsible for user accounts to inform him to create the
 newly approved account.
   Well, thanks again for the feedback.  Hopefully I can get this going
 pretty quick.  We are currently planning on rolling this app out to our
user
 community on Monday.  This is the last issue I have that I am aware of.
 
 -Original Message-
 From: CPT John W. Holmes [mailto:[EMAIL PROTECTED]
 Sent: Thursday, June 05, 2003 9:06 AM
 To: NIPP, SCOTT V (SBCSI); [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]
 Subject: Re: [PHP-DB] Datetime help in an INSERT...
 
 
  I have actually discovered that the $td value is blank.  The reason
  appears to be that the page is reloading when a button is pushed, and
that
  is when the $td value is being lost.  My question now is, how do I keep
 the
  $td value after the page is reloaded?  I would rather keep the value
from
  the original query than perform another database query to populate this
  value yet again.  Thanks yet again for the help.
 
 Stick it in the session? cookie? URL? What is $td?
 
 ---John Holmes...
 



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



RE: [PHP-DB] Datetime help in an INSERT...

2003-06-06 Thread NIPP, SCOTT V (SBCSI)
Thought I was on track, but stumped again...

I am now getting a completely different error that I cannot figure
out how it is related.  I have passed the $td variable into the function and
then get it back as a POST variable from a hidden field within the function.
Here is the error I am now seeing;

Unknown column 'sn4265' in 'field list'

This one is really throwing me at the moment as the only place the
value sn4265 is stored is in the $sbcuid variable.  This $sbcuid variable is
not a part of the INSERT that I am performing which I think is generating
this error.  I am guessing that you guys will need more info to help out
with this now.  Just let me know what you want.  Thanks again.

-Original Message-
From: CPT John W. Holmes [mailto:[EMAIL PROTECTED]
Sent: Thursday, June 05, 2003 10:07 AM
To: NIPP, SCOTT V (SBCSI)
Subject: Re: [PHP-DB] Datetime help in an INSERT...


Just pass the variable to your function. If you're using a form, then make
it a hidden element.

---John Holmes...

- Original Message - 
From: NIPP, SCOTT V (SBCSI) [EMAIL PROTECTED]
To: 'CPT John W. Holmes' [EMAIL PROTECTED]
Sent: Thursday, June 05, 2003 10:53 AM
Subject: RE: [PHP-DB] Datetime help in an INSERT...


 Do you think URL propagation is a better option than passing another
 variable into the function and then passing it back out through a hidden
 form element?  Here was another snippet from another suggestion on this.

 a button is being pressed?
 so it is processing a form?
 if its in a form just pass along the value of $td via hidden input data...

 input type=hidden name=td value=? echo $td; ?

 jay merritt
 [EMAIL PROTECTED]
 [EMAIL PROTECTED]

 -Original Message-
 From: CPT John W. Holmes [mailto:[EMAIL PROTECTED]
 Sent: Thursday, June 05, 2003 9:53 AM
 To: NIPP, SCOTT V (SBCSI)
 Subject: Re: [PHP-DB] Datetime help in an INSERT...


 Propagating it in the URL is probably the best method.

 ---John Holmes...

 - Original Message - 
 From: NIPP, SCOTT V (SBCSI) [EMAIL PROTECTED]
 To: 'CPT John W. Holmes' [EMAIL PROTECTED]; [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]
 Sent: Thursday, June 05, 2003 10:44 AM
 Subject: RE: [PHP-DB] Datetime help in an INSERT...


  OK.  I guess the next question would be what is the best option for
  performance?  This portion of the app currently doesn't have any session
  functionality built in.  I would be setting up the session for this sole
  purpose.  I haven't worked with cookies yet.  I suppose the URL method
 might
  work, I have just never like it because I think it looks unclean, just
  personal preference there.
  As to the $td question...  This is a variable that holds the userid
  of the Technical Director who is the account approver.  This portion
of
  the app is simply an approval mechanism to an account request system
that
 I
  am developing.  The TD receives an e-mail with a link back to the
 approval
  page to approve the requested accounts.  This approval then fires off an
  e-mail to the SA responsible for user accounts to inform him to create
the
  newly approved account.
  Well, thanks again for the feedback.  Hopefully I can get this going
  pretty quick.  We are currently planning on rolling this app out to our
 user
  community on Monday.  This is the last issue I have that I am aware of.
 
  -Original Message-
  From: CPT John W. Holmes [mailto:[EMAIL PROTECTED]
  Sent: Thursday, June 05, 2003 9:06 AM
  To: NIPP, SCOTT V (SBCSI); [EMAIL PROTECTED]
  Cc: [EMAIL PROTECTED]
  Subject: Re: [PHP-DB] Datetime help in an INSERT...
 
 
   I have actually discovered that the $td value is blank.  The reason
   appears to be that the page is reloading when a button is pushed, and
 that
   is when the $td value is being lost.  My question now is, how do I
keep
  the
   $td value after the page is reloaded?  I would rather keep the value
 from
   the original query than perform another database query to populate
this
   value yet again.  Thanks yet again for the help.
 
  Stick it in the session? cookie? URL? What is $td?
 
  ---John Holmes...
 
  -- 
  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



RE: [PHP-DB] Datetime help in an INSERT...

2003-06-06 Thread John W. Holmes
   I am now getting a completely different error that I cannot
figure
 out how it is related.  I have passed the $td variable into the
function
 and
 then get it back as a POST variable from a hidden field within the
 function.
 Here is the error I am now seeing;
 
 Unknown column 'sn4265' in 'field list'
 
   This one is really throwing me at the moment as the only place
the
 value sn4265 is stored is in the $sbcuid variable.  This $sbcuid
variable
 is
 not a part of the INSERT that I am performing which I think is
generating
 this error.  I am guessing that you guys will need more info to help
out
 with this now.  Just let me know what you want.  Thanks again.

Well, if $sbcuid isn't being used, something with its value is. What
does the query look like? Common sense would say that if you're having
trouble with a query, you'd at least post that bit of code, right?

---John W. Holmes...

Amazon Wishlist: http://www.amazon.com/o/registry/3BEXC84AB3A5E

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/



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



[PHP-DB] Datetime help in an INSERT...

2003-06-05 Thread NIPP, SCOTT V (SBCSI)
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:  [EMAIL PROTECTED]
Web:  http:\\ldsa.sbcld.sbc.com



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



RE: [PHP-DB] Datetime help in an INSERT...

2003-06-05 Thread NIPP, SCOTT V (SBCSI)
The error I am receiving is:

You have an error in your SQL syntax near ' NOW())' at line 1

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Wednesday, June 04, 2003 1:45 PM
To: NIPP, SCOTT V (SBCSI)
Subject: Re: [PHP-DB] 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:  [EMAIL PROTECTED]
 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



RE: [PHP-DB] Datetime help in an INSERT...

2003-06-05 Thread Rankin, Randy
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:[EMAIL PROTECTED]
Sent: Wednesday, June 04, 2003 1:47 PM
To: '[EMAIL PROTECTED]'
Cc: '[EMAIL PROTECTED]'
Subject: RE: [PHP-DB] 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: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Wednesday, June 04, 2003 1:45 PM
To: NIPP, SCOTT V (SBCSI)
Subject: Re: [PHP-DB] 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:  [EMAIL PROTECTED]
 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


RE: [PHP-DB] Datetime help in an INSERT...

2003-06-05 Thread Rankin, Randy
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:[EMAIL PROTECTED]
Sent: Wednesday, June 04, 2003 1:56 PM
To: '[EMAIL PROTECTED]'
Subject: RE: [PHP-DB] 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:[EMAIL PROTECTED]
Sent: Wednesday, June 04, 2003 1:47 PM
To: '[EMAIL PROTECTED]'
Cc: '[EMAIL PROTECTED]'
Subject: RE: [PHP-DB] 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: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Wednesday, June 04, 2003 1:45 PM
To: NIPP, SCOTT V (SBCSI)
Subject: Re: [PHP-DB] 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:  [EMAIL PROTECTED]
 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


RE: [PHP-DB] Datetime help in an INSERT...

2003-06-05 Thread NIPP, SCOTT V (SBCSI)
No, the field is a Datetime field rather than a Timestamp field.

-Original Message-
From: Rankin, Randy [mailto:[EMAIL PROTECTED]
Sent: Wednesday, June 04, 2003 1:59 PM
To: '[EMAIL PROTECTED]'
Subject: RE: [PHP-DB] 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:[EMAIL PROTECTED]
Sent: Wednesday, June 04, 2003 1:56 PM
To: '[EMAIL PROTECTED]'
Subject: RE: [PHP-DB] 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:[EMAIL PROTECTED]
Sent: Wednesday, June 04, 2003 1:47 PM
To: '[EMAIL PROTECTED]'
Cc: '[EMAIL PROTECTED]'
Subject: RE: [PHP-DB] 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: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Wednesday, June 04, 2003 1:45 PM
To: NIPP, SCOTT V (SBCSI)
Subject: Re: [PHP-DB] 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:  [EMAIL PROTECTED]
 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



Re: [PHP-DB] Datetime help in an INSERT...

2003-06-05 Thread CPT John W. Holmes
  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());

 The error I am receiving is:

 You have an error in your SQL syntax near ' NOW())' at line 1

Are you sure $td has a value? If it's blank, you'd get an error like that.

---John Holmes...


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



RE: [PHP-DB] Datetime help in an INSERT...

2003-06-05 Thread Gary . Every
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:[EMAIL PROTECTED]
http://accessingram.com


 -Original Message-
 From: NIPP, SCOTT V (SBCSI) [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, June 04, 2003 2:06 PM
 To: 'Rankin, Randy'; '[EMAIL PROTECTED]'
 Subject: RE: [PHP-DB] Datetime help in an INSERT...
 
 
   No, the field is a Datetime field rather than a Timestamp field.
 
 -Original Message-
 From: Rankin, Randy [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, June 04, 2003 1:59 PM
 To: '[EMAIL PROTECTED]'
 Subject: RE: [PHP-DB] 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:[EMAIL PROTECTED]
 Sent: Wednesday, June 04, 2003 1:56 PM
 To: '[EMAIL PROTECTED]'
 Subject: RE: [PHP-DB] 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:[EMAIL PROTECTED]
 Sent: Wednesday, June 04, 2003 1:47 PM
 To: '[EMAIL PROTECTED]'
 Cc: '[EMAIL PROTECTED]'
 Subject: RE: [PHP-DB] 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: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, June 04, 2003 1:45 PM
 To: NIPP, SCOTT V (SBCSI)
 Subject: Re: [PHP-DB] 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:  [EMAIL PROTECTED]
  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
 


RE: [PHP-DB] Datetime help in an INSERT...

2003-06-05 Thread NIPP, SCOTT V (SBCSI)
I think this is the real problem.  Basically, the $td variable is
defined intially, but upon clicking a button the page reloads itself and I
believe that at this time it is losing the $td variable.  I am not quite
sure how to prevent this from occurring.  Thanks again for all the help so
far.

-Original Message-
From: CPT John W. Holmes [mailto:[EMAIL PROTECTED]
Sent: Wednesday, June 04, 2003 2:14 PM
To: NIPP, SCOTT V (SBCSI); [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Datetime help in an INSERT...


  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());

 The error I am receiving is:

 You have an error in your SQL syntax near ' NOW())' at line 1

Are you sure $td has a value? If it's blank, you'd get an error like that.

---John Holmes...

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



Re: [PHP-DB] Datetime help in an INSERT...

2003-06-05 Thread CPT John W. Holmes
 2. Place single quotes within your VALUES parens, e.g.

If they are really strings. Integers or dates in a MMDD format do not
require quotes.

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

---John Holmes...


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