mfcdb_insert

Insert new record into table


Prototype:

int mfcdb_insert( resource $handle, string $record [, int $is_varlen] )




This function insert the data of $record into table identified by $handle. Optional argument $is_varlen specify if record is varlen type.
Keys are created automatically by engine.

RETURN: number of new record inserted if all it's ok, else FALSE. For error information you can use mfcdb_error()

Example

<?php
$resource = mfcdb_open("mydatabase");
 
if($resource == FALSE) {
  die("An error occurred opening table, error is: ".mfcdb_error()."\n");
}
 
 
$data = "42foobar";
$result = mfcdb_insert($resource, $data);
 
if($result == FALSE) {
  echo "An error occurred while inserting record, error is: ".mfcdb_error()."\n";
} else {
  echo "Inserted record ".$result."\n";
}
 
 
if(mfcdb_close($resource) == FALSE) {
  die("An error occurred closing table, error is: ".mfcdb_error()."\n");
}
 
?>
documentation/mfcdb_insert.txt · Ultima modifica: 2008/08/22 23:10 da gchiesa