PHP connects to the MYSQL database and phpmysql database. PHP connects to the MYSQL database. the phpmysql database requires PHP to connect to MySql for a project in the previous two days. although I have learned it before, I almost forgot to do so now. However, I found a lot of PHP resources to connect to the MYSQL database, phpmysql database
Because a project in the previous two days needed PHP to connect to MySql, although I have learned it before, but now I almost forgot to do it all. However, I found a lot of information and found the method:
'; Exit (-1);} else {echo "database connection successful...
";}// Select a database as the default database mysql_select_db ('php _ sjk'); // execute the SQL INSERT statement $ SQL =" INSERT INTO zh VALUES (NULL, 'Wang jie', '000000') "; $ cr = mysql_query ($ SQL); // you can determine whether the data is successfully inserted if (! $ Cr) {echo "data insertion failed.
";} Else {echo" data is inserted successfully.
";}// Run the SQL query statement $ SQL =" select * from zh "; $ cr = mysql_query ($ SQL); // Obtain the returned result set, and cyclically output echo "data display:
"; While ($ a = mysql_fetch_row ($ cr) {echo" {$ a [0]} -- {$ a [1]} -- {$ a [2]}
";}// Close the database connection mysql_close ($ link);?>
Ghost because a project in the previous two days needed PHP to connect to MySql. although I have learned it before, I almost forgot to do so now, but later I found a lot of funds...