PHP 5 mysqli Function Summary

Source: Internet
Author: User

Connecting to a database

The Mysqli_connect () function opens a new connection to the MySQL server.

 <? php $con  =mysqli_connect ( " localhost  " ,  " Span style= "COLOR: #800000" >wrong_user   ",  " my_password  " , "  my_db   " );  //  Check the connection   If  (! $con) {die (  "  connection error:  "   Mysqli_connect_error ()); } ? 

Set character encoding

// Modify the database connection character set to UTF8mysqli_set_charset ($con,"UTF8");

Execute SQL

// Execute Query mysqli_query ($con,"select * from websites");

Returns the number of rows affected

Mysqli_affected_rows (connection);

Returns the ID generated after execution

MYSQLI_INSERT_ID (connection);

Get a row from the result set as an associative array

MYSQLI_FETCH_ASSOC (result);

Releasing the result set

Mysqli_free_result (result);

Close Database Link

Mysqli_close (connection);

PHP 5 mysqli Function Summary

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.