Call to undefined function: odbc_connect()

From: Date: Wed, 07 Aug 2002 19:16:55 +0000
Subject: Call to undefined function: odbc_connect()
Groups: php.dev 
Request: Send a blank email to php-dev+get-86606@lists.php.net to get a copy of this message
I am getting this error when trying to connect to a MS Access database. I do think that it is the connection that is failing, it is the function: Fatal error: Call to undefined function: odbc_connect() in /home/sites/home/web/phptest.htm on line 37 What am I doing wrong or what have I missed. Here is a snippet of the code that I am using: function Output_Entries() { /* Make the connection to the database. The syntax is odbc_connect( 'SYSTEM_DSN' , 'USER', 'PASSWORD' ); $cnx will hold the pconnect is used to establish a persistent database connection to the Database until the procedure is completed. */ $cnx = odbc_connect( 'SLSocket' , '', '' ); if (!$cnx) { Error_handler( "Error in odbc_connect" , $cnx ); } // send a simple odbc query . returns an odbc cursor $cur= odbc_exec( $cnx, "select Index,ItemNumber,ItemDescription,ProductLine from People" ); if (!$cur) { Error_handler( "Error in odbc_exec( no cursor returned ) " , $cnx ); } echo "<table border=1><tr><th>Index</th><th>First Name</th>". "<th>Last Name</th><th>Phone Number</th></tr>\n"; $nbrow=0; //Local variable to count number of rows // fetch the succesive result rows while( odbc_fetch_row( $cur ) ) { $nbrow++; $Index= odbc_result( $cur, 1 ); // get the field "Index" $ItemNumber= odbc_result( $cur, 2 ); // get the field "ItemNumber" $ItemDescription= odbc_result( $cur, 3 ); // get the field "ItemDescription" $ProductLine= odbc_result( $cur, 4 ); // get the field "ProductLine" echo "<tr><td>$Index</td><td>$ItemNumber</td>". "<td>$ItemDescription</td><td>$ProductLine</td></tr>\n"; } echo "<tr><td colspan=2>$nbrow entries </td></tr></table>"; // close the connection. important if persistent connection are "On" odbc_close( $cnx); } function Error_Handler( $msg, $cnx ) { echo "$msg \n"; odbc_close( $cnx); exit(); } -- -- Keith Roberts IT Manager Laptops For Less 2995 White Star Anaheim, CA 92806 (714) 224 - 3980 http://www.laptopsforless.com

« previous php.dev (#86606) next »