Browser error: PHPWarning: preg_match () expects.

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


If (! $ This-> result |! Eregi ("^ Resource", $ this-> result) {return $ this-> output ("no data, please first execute the 'select' statement of SQL! ");}

If (! $ This-> result |! Preg_match ("/^ Resource/I", $ this-> result) {return $ this-> output ("no data, please execute the 'select' statement of SQL first! ");}
Since PHP has been upgraded from less than 5.2 to 5.6, all the mysql statements used have been changed to mysqli statements, and data cannot be read. I changed the statement as prompted by Baidu. Unfortunately, I still cannot use the error. how can I solve this problem now ????


Reply to discussion (solution)

$ This-> result is a resource, right?
Determine whether it is a resource application is_resource function
If (! $ This-> result |! Is_resource ($ this-> result ))

$ This-> result is a resource, right?
Determine whether it is a resource application is_resource function
If (! $ This-> result |! Is_resource ($ this-> result ))



$this -> result = @mysqli_query($this -> conn,$this -> sql);
This is the case.

Reply #1. I changed your is_resource function to solve the error. Unfortunately, I still cannot read the database.

Let's take a look at $ this-> result var_dump to see what it is.

Reply #4 var_dump ($ this-> result? 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.