From the documentation
Quote
putIntTableRow($fields="", $into="")
// function to put a row into ANY internal database table
// INSERT's a new table row into ANY internal Etomite database table. No data validation is performed.
// $fields = a $key=>$value array: $fields=("name"=>$name,"email"=$email,"age"=>$age)
// $into = name of the internal Etomite table which will receive the new data row without database name or table prefix: $into="user_messages"
// Returns FALSE on failure.
// function to put a row into ANY internal database table
// INSERT's a new table row into ANY internal Etomite database table. No data validation is performed.
// $fields = a $key=>$value array: $fields=("name"=>$name,"email"=$email,"age"=>$age)
// $into = name of the internal Etomite table which will receive the new data row without database name or table prefix: $into="user_messages"
// Returns FALSE on failure.
Example usage
Here I am writing a fictional row of two fields to a table I created on the database etomite is installed on, called etomite_my_table_name (etomite_ being the default prefix for etomite installs. Notice in the function call it is not used).
// example fields I recieved from, say, a form.
$example = 'hello';
$test = 4;
// write my fields to an array called params,
// so it can be used in the function call
$params = compact("example","test");
// write fields to database
// if putIntTableRow fails it will return false.
// so 'if not false', writes error message.
// my_table_name is the name of my
// internal table without any prefix (if used)
if (!$etomite->putIntTableRow($fields=$params, $into="my_table_name")){
// fail
// didnt write it to database for some reason
$error .= 'Error message';
return $error;
die;
}
else {
// success
// do something here
}
Needless to say, but I should say, that fields should be well validated before writing to the database.
Paul.
PS It is possible to use the extra field $addPrefix=true or $addPrefix=false in this function call, to add (or not add) the table prefix.
Edited by PaulD, 26 February 2009 - 12:51 AM.











