$conn = new COM( "ADODB.Connection") or die("Cannot start ADO"); $conn - Open("Provider=SQLOLEDB; Data Source=localhost; Initial Catalog=database; User ID=user; Password=password"); $rs = $conn - Execute("SELECT * FROM sometable"); / / Recordset $num_columns = $rs - Fields - Count(); echo $num_columns. "\n"; for ($i=0; $i $num_columns; $i++) {$fld[$i] = $rs - Fields($i);} $rowcount = 0; while (!$rs - EOF) {for ($i=0; $i $num_columns; $i++) {echo $fld[$i] - value. "\t";} echo "\n"; $rowcount++; / / increments rowcount $rs - MoveNext();} $rs - Close(); $conn - Close(); $rs - Release(); $conn - Release(); $rs = null; $conn = null;
?php $conn = new COM( "ADODB.Connection") or die("Cannot start ADO"); $conn - Open("Provider=SQLOLEDB; Data Source=localhost; Initial Catalog=database; User ID=user; Password=password"); $rs = $conn - Execute("SELECT * FROM sometable"); / / Recordset $num_columns = $rs - Fields - Count(); echo $num_columns. "\n"; for ($i=0; $i $num_columns; $i++) {$fld[$i] = $rs - Fields($i);} $rowcount = 0; while (!$rs - EOF) {for ($i=0; $i $num_columns; $i++) {echo $fld[$i] - value. "\t";} echo "\n"; $rowcount++; / / incrémente le nombre de lignes $rs - MoveNext();} $rs - Close(); $conn - Close(); $rs - Release(); $conn - Release(); $rs = null; $conn = null;?