0

I have an array I'm inserting into a table:

$leadValues = array(); $leadValues[ 'LEADCOMM' ] = getVariable('LEADCOMM'); $leadValues[ 'CCID' ] = getVariable('CCID'); $leadValues[ 'QTR' ] = getVariable('QTR'); $leadValues[ 'CLK' ] = getVariable('CLK'); $leadValues[ 'DCK' ] = getVariable('DCK'); $leadValues[ 'QS_PRODUCT' ] = getVariable('QS_PRODUCT'); $leadValues[ 'PROP_ST' ] = getVariable('PROP_ST'); $leadValues[ 'QS_PROP_DESC' ] = getVariable('QS_PROP_DESC'); $leadValues[ 'QS_CRED_GRADE' ] = getVariable('QS_CRED_GRADE'); $leadValues[ 'EST_VAL' ] = getVariable('EST_VAL'); $leadValues[ 'BAL_ONE' ] = getVariable('BAL_ONE'); $leadValues[ 'QS_FHA_BANK_FORECLOSURE' ] = getVariable('QS_FHA_BANK_FORECLOSURE'); $leadValues[ 'QS_VA_STATUS' ] = getVariable('QS_VA_STATUS'); $leadValues[ 'FNAME' ] = getVariable('FNAME'); $leadValues[ 'LNAME' ] = getVariable('LNAME'); $leadValues[ 'ADDRESS' ] = getVariable('ADDRESS'); $leadValues[ 'CITY' ] = getVariable('CITY'); $leadValues[ 'PROP_ZIP' ] = getVariable('PROP_ZIP'); $leadValues[ 'EMAIL' ] = getVariable('EMAIL'); $leadValues[ 'PRI_PHONE_1' ] = getVariable('PRI_PHONE_1'); $leadValues[ 'PRI_PHONE_2' ] = getVariable('PRI_PHONE_2'); $leadValues[ 'PRI_PHONE_3' ] = getVariable('PRI_PHONE_3'); $leadValues[ 'PPCID '] = getVariable('PPCID'); $leadValues[ 'CID' ] = getVariable('CID'); 

I want to add a final item to the array that will insert a time stamp into the table. Would something like this work?

$leadValues[ 'TS' ] = $date->format( 'd/m/Y H:i:s' ); 
1
  • 1
    have you ever heard of loops? Commented Mar 23, 2012 at 20:37

2 Answers 2

1

you may use time() function. it returns current unix timestamp

$leadValues[ 'TS' ] = time(); 
Sign up to request clarification or add additional context in comments.

Comments

0

Ideally you'd modify the table for your 'timestamp' field to be a TIMESTAMP datatype. It will do its own automatic initialization and update, taking this additional step away from PHP.

See http://dev.mysql.com/doc/refman/5.0/en/timestamp-initialization.html

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.