Php background database and foreground request combination

Source: Internet
Author: User
: This article mainly introduces the combination of php background database and foreground request. For more information about PHP tutorials, see.

  200, "message" => "logon successful"); echo (json_encode ($ dic);} else {$ dic = array ("code" => 404, "message" => "logon failed"); echo (json_encode ($ dic);} * // register the data with the database and use the data written at the front end, write to the server database // 1. GET the value of the parameter $ username =$ _ GET [username]; $ password =$ _ GET [password]; // 2. use the database // (1) to connect to the database mysql_connect // parameter 1: service // parameter 2: username for logging on to the database. we select the root user // parameter 3: password, if it is null, you can save // ** the return value BOOL $ islink = mysql_connect ("127.0.0.1", "root", ""); if ($ islink) {echo ("database connection successful
"); // (2) select DataBase mysql_select_db (" DataBase "); // (3) Check whether the user table in the DataBase has the current user name; return value (instruction set or BOOL) mysql_query // results is an array (all records) that queries all content $ results = mysql_query ("select username from users"); while ($ row = mysql_fetch_array ($ results )) {// Determine whether the username in the row record is the same as the currently registered username if ($ row ["username"] = $ username) {echo ("registration failed, username already exists
"); Return ;}/// you can perform registration. // It is equivalent to inserting data into the users table $ result = mysql_query (" insert into users (username, password) values ('$ username',' $ password') "); if ($ result) {echo (" registered successfully
");} Else {echo (" registration failed
") ;}} Else {echo (" link failed ") ;}?>

'). AddClass ('pre-numbering '). hide (); $ (this ). addClass ('Has-numbering '). parent (). append ($ numbering); for (I = 1; I <= lines; I ++) {$ numbering. append ($ ('
  • '). Text (I) ;}; $ numbering. fadeIn (1700) ;}) ;}; script

    The above introduces the combination of php background database and foreground request, including some content, and 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.