: 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.