Creates a record in a table.
int db_create_record(string tablename [, mixed fieldnames [, mixed fieldvalues [, string idfield]]])
The table below summarizes the options for fieldnames and fieldvalues.
| fieldnames |
fieldvalues |
Data inserted |
|---|---|---|
|
null |
null |
a record with all fields "0" |
|
null |
string array |
a record with all fields with their fieldvalues |
|
string array |
string array |
a record with fieldnames with their fieldvalues |
The result will be the actual id or FALSE if the record could not be created.
// Create record in mytable
$fn = array("name", "what", "OK");
$fv = array("hut", " in the summer", 1);
$res = db_create_record(null, null, $fv);
echo ("id is $res ");