1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
| <?php
include('adodb5/adodb.inc.php');
$ProviderOLEDBHFSQL = 'Provider=PCSOFT.HFSQL; Data Source=91.220.197.26:4900; Initial Catalog=testAPI; User ID=Florian; Password=*******;';
$ConnectionOLEDBHFSQL = new COM("ADODB.Connection")
or die("Impossible d'instancier un objet ADO");
$ConnectionOLEDBHFSQL ->ConnectionString = $ProviderOLEDBHFSQL;
$ConnectionOLEDBHFSQL -> Open();
/*
* Lecture de la BD (SELECT)
*/
$res = new COM("ADODB.Recordset");
$sql = "SELECT * FROM :test";
$res->Open($sql, $ProviderOLEDBHFSQL);
$index=0;
while(!$res->EOF){
for($x=0; $x<$res->Fields->Count; $x++){
$assoc_array[ $index ][ $res->Fields[$x]->Name ] = $res->Fields[$x]->Value;
echo $res->Fields[$x]->Name ." -> ". $res->Fields[$x]->Value . "<br>";
}
echo "--------------------------<br>";
$res->MoveNext();
$index++;
}
echo $index." enregistrement(s) listé(s) <br>";
$res->Close(); |