CodeCharge Studio
search Register Login  

Web Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 Coding Date for updating MYSql

Print topic Send  topic

Author Message
jgenussr

Posts: 1
Posted: 04/11/2005, 1:19 PM

I'm attempting to use the following statement in a contact_BeforeInsert Event to set the time of the last update to a record.

$contact->DATE_UPDATED_LAST->SetValue(date("mdY Hms"));

This functions always returns a date of
12/31/1969 19:00:04

I've also attempted to use the getdate() function, it returns a value of 12/31/0000

Thanks
View profile  Send private message
peterr


Posts: 5971
Posted: 04/11/2005, 2:33 PM

1. The SetValue function uses standard CCS functionality to convert dates from the database format (based on DBFormat property) to the display format (based on Format property). Unfortunately your above format doesn't look like date format used by databases, therefore it cannot be converted to a date. You can try using the SetText function instead, or set your field type to Text instead of Date.

2. Or without using custom code you can set the Default Value property to "CurrentDate" and then specify the format in the DBFormat property.

3. Or you can use Custom Insert and Custom Update properties of your form to set the date field automatically, without any fields present on the page.
Just enter date("mdY Hms") into the Parameter Source and specify Parameter Type = Expression.

_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message
mfratto

Posts: 34
Posted: 08/30/2005, 3:21 PM

I wanted to do the same thing--update a field when a record was modified. Here is what worked for me:

Set the hidden field Data Type to Text. Set the DB format (for MySql) to "yyyy-mm-dd HH:nn:ss". Then enter custom code for the FORM on the server side "Before Insert" and "Before Update." Here is the snippet I used where $notes is the form name and modified is the field name I want to update.

	$notes->modified->SetValue(date("Y-m-d H:i:s"));
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.