Basic usage of Mysqlli

Source: Internet
Author: User

Mysqli is a function after php5.
You need to modify the php.ini configuration file
Look for the following statement:
; Extension=php_mysqli.dll
Modify it to: Extension=php_mysqli.dll.

//link Database Select Database$connect=Mysqli_connect(' localhost ', ' root ', ', ' Englishok ') or die(' Unale to connect ');//set the display character set$sql= "Set Names UTF8";//Execute SQL statementMysqli_query($connect,$sql);//Select data table//query single data and output in JSON format$sql= "SELECT * from Cetsix where word= '".$word."‘";//Execute SQL statement to return result set$result=Mysqli_query($connect,$sql);$row=Mysqli_fetch_row($result);EchoJson_encode ($row);================================================$sql= "SELECT * FROM Cetsix";//Execute SQL statement to return result set$result=Mysqli_query($connect,$sql);//getting an array by looping while($row=Mysqli_fetch_row($result)){    $list[]=$row;}Print_r($list);===================================================//create the object and open the connection, and the last parameter is the name of the selected database$mysqli=NewMysqli (' localhost ', ' root ', ' ', ' conn '));//Check if the connection is successfulif(Mysqli_connect_errno()){//Note Mysqli_connect_error () new features die(' Unable to connect! ').Mysqli_connect_error();}$sql= "SELECT * from MSG";//Execute SQL statements, fully object-oriented$result=$mysqli->query ($sql); while($row=$result-Fetch_array ()) { $list[]=$row;}

Basic usage of Mysqlli

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.