ajaxCRUD.com

» a PHP class to create / read / update / delete from a database table using AJAX

   by loud canvas media

AjaxCRUD API Reference

<< Reference overview
<< Home

addValueOnInsert

sets a value to a field on row insert
void addValueOnInsert( String fieldName, String value )
This function should be used when certain fields should be immediately populated with pre-defined data. A good use of this function is when your table has a "date created" field for an entity. This field can be automatically determined (by mySQL) and then set when adding the row.

Keep in mind: this function will overwrite any value input by the user for this field. Therefore it should always be used in conjuctiton with omitAddField so that an input box for the field does not even display when adding an entry.

Details

Type function
Returns void

Parameters

fieldName
The database field name you want to be able to assign a specific data input to on row insert
value
Value to overwrite the field with - if the value is "NOW()" it is parsed not as a string, but as a mySQL expression

Example

$tblDemo->addValueOnInsert("fldCreationDate", "NOW()");

See also

New, Edit

 

"AjaxCRUD is wonderful."
~Peter Barone