Query keywords for php Data Access and php Data keywords
This example shares the php query implementation code for your reference. The details are as follows:
1. A keyword Query
Home page:
<Html>
Encapsulation class:
<? Phpclass QiChe {public $ localhost = "localhost"; // server public $ uid = "root"; // user name public $ password = ""; // password // SQL Method for executing the query statement: // parameter description: $ SQL indicates the SQL statement to be executed; $ type indicates the type of the SQL statement, and 0 indicates the query, 1 is other (add, delete, modify, and Query); $ db indicates the public function Query of the database to be queried ($ SQL, $ type = "0", $ db = "mydb ") {$ dbconnect = new MySQLi ($ this-> localhost, $ this-> uid, $ this-> password, $ db );! Mysqli_connect_error () or die ("connection failed! "); $ Result = $ dbconnect-> query ($ SQL); if ($ type = 0) {return $ result-> fetch_all ();} else {return $ result ;}}}
Running result:
2. query multiple keywords
Home page:
<Html>
Running result:
The above is all the content of this article. I hope it will help you learn php programming.