Micro-Letter Development PHP database query, reply to information, unable to obtain data? Or is it in a wrong format?

Source: Internet
Author: User
Tags php database

The process is like this

    1. Parse the sent XML to get the content sent by the user

    2. According to the content, to determine the response

    3. Reads the contents of the database, returns as a string, replies to information

But there seems to be a problem in the database operation, how can not reply. case '1'everything else is fine.

I tried to add a test to each step in the method getSql() echo '成功' , and no longer returned to the place where I commented, and the gods see what's going on.

How to view support? mysqli I am the content of the CentOS 6.7 php 5.6 phpinfo() display about mysqli as follows:

I know that there is a extension open on the PHP in Windows, what is the PHP configuration inside Linux?


/*-------------------------------------judge the information event, according to the information content sent by the user, determine the reply $arr: the parsed Data sent--------------------------------------*/Public Function Rsptext ($arr) {switch (Strtolower ($arr->co            ntent)) {case ' 1 ': {$this->replymsg ($arr, "success");            };break;            Case ' 2 ': {$this->replymsg ($arr, $this->getsql ());            };break; Case ' time ': {$this->replymsg ($arr, Date ("y-m-d"). "            \ n ". Date (" H:i:s "));            };break;        Default: $this->replymsg ($arr, "See the Sea Yo"); }}/*-----------------------------------reply message $arr: Post data parsed object $content: What to reply to, String-----------------------------------*/Public Function replymsg ($arr, $content = "") {$toUser = $arr->tous        Ername;        $fromUser = $arr->fromusername;        $time = time ();        $msgType = ' text '; $rspPatten = '
  
    
     %s 
     
     %s 
      
     
      %s 
      
      %s  
       %s 
       
     
    
   
  ';        $RSPMSG = sprintf ($rspPatten, $fromUser, $toUser, $time, $msgType, $content);    Echo $RSPMSG;        }//Read Database contents public Function GetSQL () {$host = "111.111.111.111";        $port = ' 1111 ';        $database = "WordPress";        $table = "Wp_posts";        $user = "1111";        $passwd = "1111";        $sql = "Select Post_title from" $table. "Limit 1,10"; !!!!!!!!!                        Can still return here, the following sentence will no longer return to the!!!!!!!        $link = Mysqli_connect ($host, $user, $passwd, $database, $port);        $tempResult = $link->query ($sql);        $str = "";        while ($row = $tempResult->fetch_array ()) {$str = $str. $row [' Post_title '];        } $link->close (); return $str; Return string}
  • Related Article

    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.