Php simple registration code for help & lt ;! DOCTYPE & nbsp; html & nbsp; PUBLIC & nbsp;-W3CDTD & nbsp; XHTML & nbsp; 1.0 & nbsp; TransitionalEN & nbsp; www. w3.orgTRxhtml1DTDxhtml1-transitional. dtd & gt; & lt; simple php registration code for help
Registration page
// Author: avirtuous
$ Con = mysql_connect ("localhost", "root", "") or die ('Cloud not connect: '. mysql_error ());
Mysql_select_db ("demo", $ con );
$ Un = $ _ POST ['username'];
$ Pwd = $ _ POST ['password'];
$ Result = mysql_query ("insert into user (username, password) VALUES ($ un, $ pwd )");
If ($ result ){
Echo "registration successful ";
} Else {
Echo "registration failed ";
}
?>
015-03-11 00:00:04 19492 [Note] Server socket created on IP: '::'.
2015-03-11 00:00:05 19492 [Note] Event Scheduler: Loaded 0 events
2015-03-11 00:00:05 19492 [Note] wampmysqld: ready for connections.
Version: '5.6.12-log' socket: '' port: 3306 MySQL Community Server (GPL)
[Wed Mar 11 14:50:59.548409 2015] [:error] [pid 6216:tid 1696] [client ::1:13262] PHP Stack trace:, referer: http://localhost/zc.html
[Wed Mar 11 14:50:59.549479 2015] [:error] [pid 6216:tid 1696] [client ::1:13262] PHP 1. {main}() E:\\wamp\\www\\reg.php:0, referer: http://localhost/zc.html
[Wed Mar 11 14:50:59.549479 2015] [:error] [pid 6216:tid 1696] [client ::1:13262] PHP 2. mysql_connect() E:\\wamp\\www\\reg.php:3, referer: http://localhost/zc.html
------ Solution ----------------------
Does the landlord change the password of myadmin without changing the password of mysql. It seems that you have encountered this problem before.
------ Solution ----------------------
Since the password is empty
You write
Mysql_connect ("localhost", "root ","")
Mysql_connect ("localhost", "root ","")
Obviously there is a space.