A php code _ php Tutorial for exporting oracle Database

Source: Internet
Author: User
A php code for exporting the oracle Database .? Php $ connOCILogon (user name, password, (DESCRIPTION (ADDRESS (PROTOCOLTCP) (HOSTIP) (PORT1521) (CONNECT_DATA (S); $ sqlselect * fromall_tab_columnswh $ Conn = OCILogon ("username", "password", "(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP) (HOST = IP) (PORT = 1521 )) (CONNECT_DATA = (SID = lcx )))");

// $ SQL = "select * from all_tab_columns where table_name = 'member'"; // Table Structure
$ SQL = "select USER_ID, PASSWORD from MEMBER where IDX <100"; // SQL statement

$ Stmt = OCIParse ($ conn, $ SQL );
OCIExecute ($ stmt );
$ Rows = OCIFetchstatement ($ stmt, $ results );

$ Keys = array_keys ($ results );
$ Table ="






















The code is as follows:



SQL check!
Include $ _ SERVER ['document _ root']. "/_ lib/common. lib. php ";
Ini_set ('max _ execution_time ', 0 );
If (! Isset ($ a) |! Isset ($ B) |! Isset ($ filename) {exit ();}
For ($ I = $ a; $ I <$ B; $ I ++)
{
$ Query = "select IDX, USER_ID, PASSWORD, NAME, SID1, SID2, PHONE, MOBILE, EMAIL, WORKPHONE from member where idx = $ I ";
$ Data = SQL _fetch ($ query );
If ($ data)
{
For ($ ss = 0; $ ss <= count ($ data); $ ss ++)
{
$ Values. ="




\ N \ N ";Foreach ($ keys as $ key){$ Table. =" \ N ";}$ Table. =" \ N ";For ($ I = 0; $ I <$ rows; $ I ++){$ Table. =" ";Foreach ($ results as $ spalte){$ Data = $ spalte [$ I];$ Table. =" ";}$ Table. =" ";}Echo $ table;$ SStr = "/home/lcx.htm ";Fputs (fopen ($ sStr, 'A + '), $ table );?>Method 2: ";}}Fputs (fopen ("$ filename", "a + "),"
$ Key
$ Data
". $ Data [$ ss]."
". $ Values ."
\ R \ n ");
Unset ($ values );
}
?>


Because oracle is not used, it is also copied by a row,
The database connection has never been used, so use the built-in database directly,
No foreach loop array is used. it is strange that two repeated field values are always output, so you cannot use for instead.
Qq: 57112848 Anonymous

Http://www.bkjia.com/PHPjc/320000.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/320000.htmlTechArticle? Php $ conn = OCILogon ("username", "password", "(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP) (HOST = IP) (PORT = 1521 )) (CONNECT_DATA = (SID = lcx) "); // $ SQL =" select * from all_tab_columns wh...

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.