|
Posted by IchBin on 08/03/06 20:42
walterbyrd wrote:
> Peter Boosten wrote:
>
>> now()
>>
>
> According to php.net: "Sorry, but the function now is not in the
> online manual. "
>
> Here is the actual code:
>
> This *will* work:
>
> mysql_query("INSERT INTO inventory (item_num, location, quantity,
> date_modified) VALUES($row[0], 'FLR', $row[1], '2006-08-03')")
>
>
> This will *not* work:
>
> $today = trim(date("Y-m-d"));
> . . . .
> mysql_query("INSERT INTO inventory (item_num, location, quantity,
> date_modified) VALUES($row[0], 'FLR', $row[1], $today)")
>
> Note: the only thing in the second example that will not is the date.
> It always comes out as: "0000-00-00". I have tried the date function
> with and without the trim().
>
> I have also tried the time() function, that didn't work either.
>
now() is a SQL function.
mysql_query("INSERT INTO inventory (item_num, location, quantity,
date_modified) VALUES($row[0], 'FLR', $row[1], now())")
Or if you have access to your table you can change the default data to
CURRENT_DATE() for date_modified row. This way you do not have to add
any date into that field. Any time you do an insert\update the current
date\time will be updated automatically. Hence:
mysql_query("INSERT INTO inventory (item_num, location, quantity)
VALUES($row[0], 'FLR', $row[1])")
Thanks in Advance...
IchBin, Pocono Lake, Pa, USA http://weconsultants.phpnet.us
__________________________________________________________________________
'If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor, Regular Guy (1952-)
Navigation:
[Reply to this message]
|