-
-
Save statgeek/c649ff0e18cab8d403ed to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$conn = new COM("ADODB.Connection"); | |
$conn->Open('Provider=sas.IOMProvider.9.3;User ID=user;Password=pass;Data Source="";SAS Machine DNS Name=my.server.com;SAS Port=8591;SAS Protocol=2'); | |
$cmd = new COM("ADODB.Command"); | |
$cmd->ActiveConnection = $conn; | |
$cmd->CommandType = 1; | |
$cmd->CommandText = 'libname foo "/my/path"'; | |
$cmd->Execute(); | |
$recordSet = $conn->Execute("select * from foo.my_table"); | |
$recordSet->MoveFirst(); | |
do { | |
for ($i=0; $i < $recordSet->Fields->Count; $i++) { | |
echo $recordSet->Fields->Item($i)->Name . ": " . $recordSet->Fields->Item($i)->Value . "\n"; | |
} | |
echo "\n\n"; | |
$recordSet->MoveNext(); | |
} while ($recordSet->EOF == FALSE); | |
$recordSet->Close(); | |
$conn->Close(); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment