The odbc_close() function is used to close an ODBC connection.
An ODBC Example
The following example shows how to first create a database connection, then a result-set, and then display the data in an HTML table.
<> <>
< ?php $conn=odbc_connect('northwind','',''); if (!$conn) {exit("Connection Failed: " . $conn);} $sql="SELECT * FROM customers"; $rs=odbc_exec($conn,$sql); if (!$rs) {exit("Error in SQL");} echo "<><>"; echo "<>Companyname< /th >"; echo "<>Contactname< /th >< /tr >"; while (odbc_fetch_row($rs)) { $compname=odbc_result($rs,"CompanyName"); $conname=odbc_result($rs,"ContactName"); echo "<><>$compname< /td >"; echo "<>$conname< /td >< /tr >"; } odbc_close($conn); echo "< /table >"; ? >
< /body > < /html > |