This topic is locked

Using now() function in custom pages in phprunner 3.1

1/22/2007 4:35:27 AM
PHPRunner General questions
OCTheEagle author

Hi,
I have got a table with one collumn called 'edittijd' (edit time). Every time an user changes a record, the field in the corresponding column gets the value of the current date and time. This can be done by building a custom page 'before edit'. Reason of this is that an user can see when the record has been updated. Code follows below.

function BeforeEdit(&$values, $where)

{
// Parameters:

// $values - Array object.

// Each field on the Edit form represented as 'Field name'-'Field value' pair

// $where - string with WHERE clause pointing to record to be edited
//********** Custom code ************

// put your custom code here

$values["Edittijd"]="now()";

return true;
// return true if you like to proceed with editing this record

// return false in other case
}


Problem is however that in 3.x versions of phprunner, I get the following error when I want to change the record.

'Record was not updated, Incorrect datetime value: 'now()' for column 'Edittijd' at row 1'

  • I've tried it both using phprunner versions 4.4 and 5.0
  • When removing the custom pages, everything works fine
  • Edittijd has a 'datetime' type in mysql

T
thesofa 1/22/2007

Hi,

I have got a table with one collumn called 'edittijd' (edit time). Every time an user changes a record, the field in the corresponding column gets the value of the current date and time. This can be done by building a custom page 'before edit'. Reason of this is that an user can see when the record has been updated. Code follows below.

function BeforeEdit(&$values, $where)

{
// Parameters:

// $values - Array object.

// Each field on the Edit form represented as 'Field name'-'Field value' pair

// $where - string with WHERE clause pointing to record to be edited
//********** Custom code ************

// put your custom code here

$values["Edittijd"]="now()";

return true;
// return true if you like to proceed with editing this record

// return false in other case
}


Problem is however that in 3.x versions of phprunner, I get the following error when I want to change the record.

'Record was not updated, Incorrect datetime value: 'now()' for column 'Edittijd' at row 1'

  • I've tried it both using phprunner versions 4.4 and 5.0
  • When removing the custom pages, everything works fine
  • Edittijd has a 'datetime' type in mysql



Change it to this

// put your custom code here

$values["Edittijd"]=now();

return true;



hth