> I have this which inserts a stock trade entry:
>
> $sql1 = "INSERT INTO $table_name
> (stock, shares, LorS, type, price1, time1) VALUES
> (\"$stock\", \"$shares\", \"$LorS\", \"$type\", \"$price1\", NOW())";
>
> With price1 being the entry price and time1 the date/time of entry.
> Then when I exit the trade it will do this:
>
> $sql1 = "update $table_name set stock = '$stock',
> shares = '$shares', LorS = '$LorS', type = '$type',
> price1 = '$price1', price2 = '$price2', time2 = NOW() where id = '$id'";
>
> However, time1 is being updated to be the same as time2 after
> the exit and I don't want it to be. Am I missing something?


Jeff,

The information provided does not say, but are the timeN columns declared as TIMESTAMP 
data types?
In which case time1 is not being 'replaced' by time2, but being the first TIMESTAMP 
field is being updated to
the NOW() time of the UPDATE operation.
Please read up about automatic updating in the manual 7.3 Column Types and 7.3.3.2 The 
DATETIME, DATE, and
TIMESTAMP Types.
If correct, recommend changing data type to Integer(10) - must be at least 4Bytes, to 
hold the timestamp value
but not be subject to update.

Regards,
=dn



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to