Add a row to a database
List the structure of a database
array Ajout_BDD( login, motdepasse, bdd, ligne)
Description
Add a row to the database bdd.
Parameters (required)
login: customer ID (nichandle)
motdepasse: the password
bdd: the database identifier (see List databases)
ligne: an array containing the values to insert (see Retrieve database structure) or a serialized array.
Return value
An array where each row contains an array with the structure:
- true (1) or false (0)
Error messages
No field must be left empty login
No field must be left empty motdepasse
No field must be left empty bdd
Authentication error (invalid login / password)
This database does not appear to belong to you
Example with NuSOAP
The following example inserts a row in a database with the following structure (see Retrieve database structure to retrieve the structure):
Array
(
[0] => Array
(
[id] =>
[field] => Email
[key] =>
)
[1] => Array
(
[id] =>
[field] => Societe
[key] =>
)
[2] => Array
(
[id] =>
[field] => Adresse
[key] =>
)
[3] => Array
(
[id] =>
[field] => Code_postal
[key] =>
)
[4] => Array
(
[id] =>
[field] => Ville
[key] =>
)
[5] => Array
(
[id] =>
[field] => Telephone
[key] =>
)
[6] => Array
(
[id] =>
[field] => Fax
[key] =>
)
[7] => Array
(
[id] =>
[field] => Site_web
[key] =>
)
)example:
include('nusoap/nusoap.php');
$client = new soapclient('https://www.eml-srv.com/_soap/control.php'); // Remove the 's' from https if CURL is not installed
$ligne=array('email@domain.com','The company','The address','The postal code','The city','The phone','The fax','The website');
$parametres = array( 'login'=>'your_login', 'motdepasse'=>'your_password', 'bdd'=>'21', 'ligne'=>$ligne );
// or $parametres = array( 'login'=>'your_login', 'motdepasse'=>'your_password', 'bdd'=>'21', 'ligne'=>serialize($ligne) );
$variable=$client->call('Ajout_BDD', $parametres);
// Retrieve the error, if any
if($client->fault)
die("Error:Code: {$client->faultcode}"
. "Detail: {$client->faultactor}"
. "Solution: {$client->faultstring}");
echo $variable;Example with PHP5
try { $client = new SoapClient(null, array('location' => "https://www.eml-srv.com/_soap/control.php", 'uri' => "https://www.eml-srv.com", 'encoding'=>'ISO-8859-1' ));
$variable = $client->Ajout_BDD('your_login','your_password','21',$ligne); //or //$variable = $client->__soapCall(Ajout_BDD,$parametres);
// or $variable = $client->Ajout_BDD('your_login','your_password','21',serialize($ligne));
//$variable=unserialize(rawurldecode($variable)); print_r($variable); } catch (SoapFault $fault) {
trigger_error("SOAP Fault: (faultcode: {$fault->faultcode}, faultstring: {$fault->faultstring})", E_USER_ERROR);
}Last updated on