Why is this exception?

Source: Internet
Author: User
Why does this error occur in the LNMP system? the php code 5.3 is as follows & lt ;? Phpclass & nbsp; db {? & Nbsp ;???????? Private & nbsp; $ _ link ;?????????????????? Function & nbsp ;__ cons Why This error occurs
LNMP system, php is 5.3

The code is as follows:

Class db {?
???????? Private $ _ link;
??????????
???????? Function _ construct ($ dbhost = 'localhost', $ dbuser = 'root', $ dbpassword = '', $ dbname = 'test ', $ charset = 'utf-8 '){?
???????????? $ This-> _ link = mysql_connect ($ dbhost, $ dbuser, $ dbpassword, true );?
???????????? $ This-> _ link or $ this-> errmsg ('The MYSQL server cannot be connected! ');?
???????????? If ($ this-> version ()> '4. 1 '){?????????????????
???????????????? $ This-> query ('set names'. $ charset );????????
????????????}?
????????????
???????????? Mysql_select_db ($ dbname, $ this-> _ link) or $ this-> errmsg ('The database cannot be connected! ');?
????????}?
??????????
????????
???????? Public function query ($ SQL) {??????????????????????????????????????? ???????????????????????
???????????? $ Result = mysql_query ($ SQL, $ this-> _ link );?
???????????? $ Result or $ this-> errmsg ('SQL statement execution error! ');?
???????????? Return $ result ;?
????????}
???????????
????????
????????
????????
????????
???????? Public function fetch_array ($ result, $ type = MYSQL_ASSOC ){
???????????? Return mysql_fetch_array ($ result, $ type );????
????????}
???????????
????????
???????? Public function fetch_object ($ result ){?
???????????? Return mysql_fetch_object ($ result );?
????????}
???????????
????????
???????? Public function affected_rows (){?
???????????? Return mysql_affected_rows ($ this-> _ link );?
????????}?
??????????
????????
???????? Public function free_result ($ result ){?
???????????? Return mysql_free_result ($ result );??
????????}?
??????????
????????
???????? Public function num_rows ($ result ){?
???????????? Return mysql_num_rows ($ result );?
????????}
????????????
????????
???????? Public function num_fields ($ result ){?
???????????? Return mysql_num_fields ($ result );?
????????}?
??????????
????????
???????? Public function insert_id (){?
???????????? Return mysql_insert_id ($ this-> _ link );?
????????}
???????????
????????
???????? Private function errmsg ($ msg ){?
???????????? $ Message? ='A MySQL error occurred! ';?
???????????? $ Message. ='Error code:'. Mysql_errno ($ this-> _ link ).' ';?
???????????? $ Message. ='Error description:'. $ Msg. mysql_error ($ this-> _ link ).' ';?
???????????? $ Message. ='Error Time:'. Date ('Y-m-d H: I: s ');?
???????????? Exit ($ message );?
????????}
???????????
????????
???????? Public function link_id (){?
???????????? Return $ this-> _ link ;?
????????}
????????????
????????
???????? Public function version (){?
???????????? Return mysql_get_server_info ($ this-> _ link );?
????????}?
??????????
????????
???????? Function getip (){?
???????????? If (getenv ("HTTP_CLIENT_IP") & strcasecmp (getenv ("HTTP_CLIENT_IP"), "unknown ")){?
???????????????? $ Ip = getenv ("HTTP_CLIENT_IP ");?
????????????} Elseif (getenv ("HTTP_X_FORWARDED_FOR") & strcasecmp (getenv ("HTTP_X_FORWARDED_FOR"), "unknown ")){?

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.