PHP connector connected to ODBC proxy

Source: Internet
Author: User

I don't know how long my IT path can go, and I will not be able to learn IT for a while later. I will be interested in myself and learn IT as much as I can ....

This is an example of using a PHP connector to connect to ODBC (copied). ODBC should also be set. Be sure to select the system DSN. My colleague said that ODBC performance is not good! Take care of it ....

<?
/* This example shows how to use PHP4 to access the database through ODBC */
?>
<HTML>
<HEAD>
<Meta name = "GENERATOR" Content = "Microsoft Visual Studio 6.0">
<Style type = "text/css">
<! --
Input {font-size: 9pt ;}
A: link {text-decoration: underline; font-size: 9pt; color: 000059}
A: visited {text-decoration: underline; font-size: 9pt; color: 000059}
A: active {text-decoration: none; font-size: 9pt}
A: hover
Body, table {font-size: 9pt}
Tr, td
-->
</Style>
<Title> list of registered members-demonstration of database access through ODBC </title>
</HEAD>
<Body alink = "# FF0000" link = "#000099" vlink = "# CC6600" topmargin = "8" leftmargin = "0" bgColor = "# FFFFFF">
<Br> <center> <font color = green size = 3> <B> member column table </B> </font> </center>
<Br>
<Table cellspacing = 0 bordercolordark = # FFFFFF width = "95%" bordercolorlight = #000000 border = 1 align = "center" cellpadding = "2">
<Tr bgcolor = "#6b8ba8" style = "color: FFFFFF">
<Td width = "5%" align = "center" valign = "bottom" height = "19"> ID </td>
<Td width = "10%" align = "center" valign = "bottom"> name </td>
<Td width = "5%" align = "center" valign = "bottom"> gender </td>
<Td width = "5%" align = "center" valign = "bottom"> age </td>
<Td width = "20%" align = "center" valign = "bottom"> contact number </td>
<Td width = "20%" align = "center" valign = "bottom"> email </td>
<Td width = "20%" align = "center" valign = "bottom"> Home address </td>
</Tr>
<?
// Connect to the ODBC database
$ Myconn = odbc_connect ("phptest", "sa", "etc ");
$ StrSql = "select * from reguser ";
/* Execute the query */
$ Result = odbc_do ($ myconn, $ strSql );
// Boolean odbc_fetch_row (integer result, integer row)
While (odbc_fetch_row ($ result) // read data through Loop
{
?>
<Tr>
<Td align = "center" height = "19"> <? Echo odbc_result ($ result, 1)?> </Td>
<Td align = "center"> <? Echo odbc_result ($ result, 2)?> </Td>
<Td align = "center"> <? Echo odbc_result ($ result, 3)?> </Td>
<Td align = "center"> <? Echo odbc_result ($ result, 4)?> </Td>
<Td align = "center"> <? Echo odbc_result ($ result, 5)?> </Td>
<Td align = "center"> <? Echo odbc_result ($ result, 6)?> </Td>
<Td align = "center"> <? Echo odbc_result ($ result, 7)?> </Td>
</Tr>
<?
}
// Close the connection to the database
Odbc_close ($ myconn );
?>
</Table>
</BODY>
</HTML>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.