About the browser error problem PHP Warning:preg_match () expects.

Source: Internet
Author: User
PHP Warning:preg_match () expects parameter 2 to is string, object given in C:\inetpub\wwwroot\hp\4.php on line 80


if (! $this, Result | |!eregi ("^resource", $this and result)   {        return $this->output ("No data, Please execute SQL's ' SELECT ' statement first! ");      

if (! $this, Result | |!preg_match ("/^resource/i", $this and result)  {        return $this->output ("No data, Please execute SQL's ' SELECT ' statement first! ");      
Since PHP upgraded from 5.2 to 5.6, the original MySQL statement was changed to MYSQLI statement, the result can not read the data. According to Baidu hint changed the statement unfortunately still can not use error, now how to solve????


Reply to discussion (solution)

$this->result A resource, right?
Determine if the Is_resource function is applied to a resource
if (! $this->result | |! Is_resource ($this->result))

$this->result A resource, right?
Determine if the Is_resource function is applied to a resource
if (! $this->result | |! Is_resource ($this->result))



$this, result = @mysqli_query ($this, conn, $this-SQL);
That's the way it is.

Reply #1, I changed your is_resource function to solve the error problem, but still can not read the database

You var_dump $this->result to see what it is.

Reply #4 var_dump ($this, result) so? Where to add

  • 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.