davemere Posted December 14, 2007 Share Posted December 14, 2007 Hi y'all I'll keep this simple! Here's my code: $conn = odbc_pconnect("conn", "id", "pwd"); if (odbc_error()) { echo "Connection failed <br>"; exit; } else { echo "Connection successful"; }; $qry = "SELECT count(*) FROM <table>"; $result = odbc_exec($conn, $qry); echo odbc_result($result,1); Here's the result! Connection successful Warning: odbc_exec() [function.odbc-exec]: SQL error: [sybase][ODBC Driver]Optional feature not implemented, SQL state HYC00 in SQLSetStmtOption in C:\www\sybconnect-odbc.php on line 20 Warning: odbc_result(): supplied argument is not a valid ODBC result resource in C:\www\sybconnect-odbc.php on line 21 This should be so simple!! It can't be a code problem. Can anyone offer a hint as to what feature I'm missing? thanks! Quote Link to comment Share on other sites More sharing options...
davemere Posted December 17, 2007 Author Share Posted December 17, 2007 bbbbbump! Excuse the bad form, but this one is really frying me! Has anyone out there managed to successfully work with Sybase and PHP? I just can't imagine this isn't possible! Quote Link to comment Share on other sites More sharing options...
VirusDoctor Posted December 17, 2007 Share Posted December 17, 2007 Hi Dave, if the query is working, you can always mask that error and make it no longer show by using a magic little thing in php: Just add a @ symbol before the query and you will no longer see that error. Please note however that although the error wont show, it doesn't mean it isn't still there Shaun Quote Link to comment Share on other sites More sharing options...
davemere Posted December 17, 2007 Author Share Posted December 17, 2007 Ummm thanks, but I want to remove the error rather than hide it! Besides which, the code isn't working. All that's returned is the error message, not the data I requested. I wonder now if it really is connecting at all to be honest. Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted December 17, 2007 Share Posted December 17, 2007 From the manual for odbc_error() - "This function returns meaningful value only if last odbc query failed." Calling odbc_error after the query might provide additional information about the connection. You need to test the resource returned by the odbc_connect() to find if the connection worked. Is the first parameter in your odbc_connect() the name of a DSN that you have setup? Quote Link to comment Share on other sites More sharing options...
davemere Posted December 19, 2007 Author Share Posted December 19, 2007 From the manual for odbc_error() - "This function returns meaningful value only if last odbc query failed." Calling odbc_error after the query might provide additional information about the connection. odbc_error returns this message: [sybase][ODBC Driver]Optional feature not implemented You need to test the resource returned by the odbc_connect() to find if the connection worked. Sure. Does the following line not provide a test of the resource? How else might I do it if necessary? $result = odbc_exec($conn, $qry) Is the first parameter in your odbc_connect() the name of a DSN that you have setup? Yes. It's the name of a ODBC data source, tested it with MS Access and it works ?????? I think I'm going to try java instead. PHP/Sybase is beginning to frustrate... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.