The above link applies and for PHP you may need to set the Idenity to be the launching user to get all the tests to run successfully. Here is a test program for you:-
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title>QODBC PHP Script To Display SQL Results</title> </head> <body topmargin="3" leftmargin="3" marginheight="0" marginwidth="0" bgcolor="#ffffff" link="#000066" vlink="#000000" alink="#0000ff" text="#000000">
<table > <tr> <td> <table border="2" bordercolor="black" bgcolor="white" cellpadding="5" cellspacing="0"> <thead> <caption align="top">QODBC PHP Script To Display SQL Results</caption> <tr> <th>Row</th> <?php set_time_limit(120); #Connect to a System DSN "QuickBooks Data" with no user or password $oConnect = odbc_connect("QuickBooks Data", "", ""); #Set the SQL Statement $sSQL = "SELECT TOP 50 ListID, FullName, CompanyName FROM Customer"; #Perform the query $oResult = odbc_exec($oConnect, $sSQL); $lFldCnt = 0; $lFieldCount = odbc_num_fields($oResult); while ($lFldCnt < $lFieldCount) { $lFldCnt++; $sFieldName = odbc_field_name($oResult, $lFldCnt); echo '<th> ' . $sFieldName . ' </th>'; } echo ' </tr> </thead> <tbody> '; $lRecCnt = 0; #Fetch the data from the database while(odbc_fetch_row($oResult)) { $lRecCnt++; echo' <tr>'; echo' <td> ' .$lRecCnt. ' </td> '; $lFldCnt = 0; $lFieldCount = odbc_num_fields($oResult); while ($lFldCnt < $lFieldCount) { $lFldCnt++; $sFieldValue = trim(odbc_result($oResult, $lFldCnt)); If ($sFieldValue == "") { echo '<td> </td>'; } else { echo ' <td valign=\"Top\"> '. $sFieldValue. ' </td>'; } } echo ' </tr>'; } #Close the connection odbc_close($oConnect); echo ' </tbody> <tfoot> <caption align=\"bottom\">Results of: '.$sSQL.'</caption> </tfoot> '; ?> </table> </td> </tr> </table> </body> </html> |