Hey all. I'm trying to run ODBC and getting the error:

PHP Fatal error: Call to undefined function odbc_connect() in /opt/csw/apache2/share/htdocs/webbots/phpconnect.php on line 2

After running phpinfo(), here is the line containing the odbc information.

--with-unixODBC=shared,/opt/csw' '--with-pdo-odbc=shared,unixODBC,/opt/csw'

The script in question is running from directory:

/opt/csw/apache2/share/htdocs/webbots

ODBC appears to be configured into the PHP install, so what could be preventing it from running?

BEGIN Actual script
<?php
$conn=odbc_connect(webbot.dsn,'userid','password');
if (!$conn)
{exit("Connection Failed: " . $conn);}
$sql="SELECT * FROM www_user";
$rs=odbc_exec($conn,$sql);
if (!$rs)
{exit("Error in SQL");}
echo "<table><tr>";
echo "<th>Companyname</th>";
echo "<th>Contactname</th></tr>";
while (odbc_fetch_row($rs))
{
$compname=odbc_result($rs,"user_id");
$conname=odbc_result($rs,"cust_num");
echo "<tr><td>$compname</td>";
echo "<td>$conname</td></tr>";
}
odbc_close($conn);
echo "</table>";
?>
END Actual Script

    Are you sure your extension is loading?

    Did you check the php.ini for your ODBC extension and settings?

    Can you see any ODBC information in phpinfo() other than in the configure line?

      Write a Reply...