PHP database manipulation (self-owned) ODBC-Oracle

Source: Internet
Author: User
// Start table definition
$ T_data = "zl_t_data ";
$ T_data_class = $ t_data. "_ class ";
$ T_data_keyword = $ t_data. "_ keyword ";
// Define the end of the table
Class odbc_oracle
{
VaR $ host = "php_oracle"; // defines the ODBC Data Source
VaR $ user = "soohuo"; // define the user name
VaR $ passwd = "soohuo"; // defines the password.
// Database connection
Function connect ()
{
$ Con = odbc_connect ($ this-> host, $ this-> User, $ this-> passwd );
If (! $ Con)
{
Echo "ODBC is not connect!
";
Exit ();
}
// Odbc_autocommit ($ con );
Return $ con;
}
// SQL statement execution
Function query ($ con, $ SQL)
{
If (empty ($ con ))
{
Echo "ODBC connect success value is not null!
";
Exit ();
}
If (empty ($ SQL ))
{
Echo "odbc SQL value is not null!
";
Exit ();
}
$ Result = odbc_do ($ con, $ SQL );
Return $ result;

}
// Handle for successful execution. The parameter is the handle after the SQL statement is executed.
Function fetch_row ($ result)
{
If (empty ($ result ))
{
Echo "ODBC query success is null!
";
Exit ();
}
$ ROW = odbc_fetch_row ($ result );
// If (! $ Row)
//{
// Echo "ODBC query error!
";
// Exit ();
//}
Return $ row;

}
// Close the database. The parameter is the connection handle.
Function close ($ con)
{
If (empty ($ con ))
{
Echo "ODBC connect is not null!
";
Exit ();
}
Odbc_close ($ con );
}
}
?>

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.