mfcdb_fetch

Fetch a record in a table pointed by a key.


Prototype:

string mfcdb_fetch( resource $handle, string $key , int $key_number )




The function get the record pointed by $key in table indentified by $handle. The arguments $key_number specifies if the search must be executed on a specify key (0…n). Value 0 is PRIMARY KEY. If $key_number is not specified the engine use first key type with same length of $key.

RETURN: The function returns a string with record data or FALSE if an error occurred. You can use mfcdb_error() to get string description of error code.

Example

<?php
$resource = mfcdb_open("mydatabase");
 
if($resource == FALSE) {
  die("An error occurred opening table, error is: ".mfcdb_error()."\n");
}
 
$data = mfcdb_fetch($resource, "256", 0);
 
if($data == FALSE) {
  echo "Error fetching data, error is: ".mfcdb_error()."\n";
} else {
  echo "DATA: ".print_r($data, true)."\n";
}
 
 
if(mfcdb_close($resource) == FALSE) {
  die("An error occurred closing table, error is: ".mfcdb_error()."\n");
}
 
?>
documentation/mfcdb_fetch.txt · Ultima modifica: 2009/07/29 10:49 da gchiesa