mfcdb_replace

Replace a record in table of database


Prototype:

boolean mfcdb_replace( resource $handle, string $key, string $new_record )




This function in table identified by $handle, replace existing record pointed by $key with $new_record. The engine takes care of updating each key associated to record.

RETURN: The function returns TRUE or FALSE

Example

<?php
$resource = mfcdb_open("mydatabase");
 
if($resource == FALSE) {
  die("An error occurred opening table, error is: ".mfcdb_error()."\n");
}
 
 
$data = "42newfoobar";
$key = substr($data, 0, 2);
 
$result = mfcdb_replace($resource, $key, $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_replace.txt · Ultima modifica: 2008/08/22 23:25 da gchiesa