Use php to complete a user registration and management demo (2)

Source: Internet
Author: User
: 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.

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.