: This article describes how to use php to complete user registration and management demo (2). For more information about PHP tutorials, see. Here we must talk about the database.
The first is the content of the configs file under the configs file.
define("DB_HOST","localhost");
define("DB_USER","root");
define("DB_PWD","");
define("DB_DBNAME","test");
define("DB_CHARSET","utf-8");
?>
The database address, administrator and password, and database name and encoding method are defined by default. After these contents are set in this file
Mysql. func. php is used.
For example:
Function connect (){
$ Link = mysql_connect (DB_HOST, DB_USER, DB_PWD) or die ("database connection failure Error:". mysql_errno (). ":". mysql_error ());
Mysql_set_charset (DB_CHARSET );
Mysql_select_db (DB_DBNAME) or die ("failed to open the specified database ");
Return $ link;
}
Here is the required login processing part.
Continue to add | View List ";} else {// if the corresponding file exists, delete it. (Because the database query failed) $ filename = ".. /uploads /". $ uploadFile [0] ['name']; if (file_exists ($ filename) {unlink ($ filename) ;}$ mes = "failed to add ";} return $ mes ;}
All the operations in mysql. func. php are to reorganize an input array into a string and then execute it in the specified data table.
Next we will discuss the compilation of listPro. php. on this interface, we will introduce the code paging technology of php.
The above describes how to use php to complete a user registration and management demo (2), including some content, hope to be helpful to friends who are interested in PHP tutorials.