Common MySQL Functions

Source: Internet
Author: User
Tags mysql functions

The mysql_connect () function locally creates a connection to the MySQL server

/*/$link = mysql_connect (' localhost ', ' root ', ') or Die (' cannot connect to the database server!) The database may not be started. or the user name password is wrong! '. Mysql_error ()); if ($link) {    echo "database connection succeeded!") ;}

mysql_select_db () function connect MySQL database test

/** * Use mysql_connect () function to connect MySQL database*/$link=mysql_connect(' localhost ', ' root ', ') or die(' cannot connect to the database server!) The database may not be started or the user name password is incorrect! '.Mysql_error());//connect to MySQL server$db _selected = mysql_select_db (' Test ', $link); Connecting to a database Db_database18if($db _selected){    Echo"Database connection succeeded!";}Else{    Echo' Database connection failed! ';}?>

mysql_query () function connect MySQL database Test

/*/$linkmysql_connectdie (' cannot connect to the database server!) may be the database is not started, or the user name password is incorrect! '. Mysql_error ());                  // connect to MySQL server $db _selected = mysql_query (' Use test ', $link);             Connection data See testif($db _selected) {    echo ' database selected successfully! ' ;}? >

Common MySQL Functions

Related Article

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.