My Problems? What's the problem? The code is as follows: & lt ;? Php & nbsp; @ mysql_connect (& quot; localhost & quot;, & quot; root & quot;, & quot; 1234567 & quot ;) before selecting a database, you need to connect to the database server & nbsp; ordie (& quot; database server connection failure & q my problem? What's the problem?
The code is as follows:
// @ Mysql_connect ("localhost", "root", "1234567") // you must connect to the database server before selecting a database.
// Or die ("database server connection failed ");
// @ Mysql_select_db ("test" // select the database mydb
// Or die ("The database does not exist or is unavailable ");
// Obtain user input
$ Username = $ _ POST ['username'];
$ Passcode = $ _ POST ['passcode'];
$ Cookie = $ _ POST ['cooker'];
// Execute the SQL statement
// $ Query = @ mysql_query ("select username, userflag from users"
//. "Where username = '$ username' and passcode =' $ passcode '")
// Or die ("SQL statement execution failed ");
// Determine whether the user exists and the password is correct
If ($ username = "hhh" & $ passcode = "12345 ")
{
Switch ($ cookie) // Set the cookie retention time based on the user's selection
{
Case 0: // Save the Cookie as a browser process
Setcookie ("username", $ username );
Break;
Case 1: // save for 1 day
Setcookie ("username", $ username, time () + 24*60*60 );
Break;
Case 2: // save for 30 days
Setcookie ("username", $ username, time () + 30*24*60*60 );
Break;
Case 3: // save 365 days
Setcookie ("username", $ username, time () + 365*24*60*60 );
Break;
}
Header ("location: main. php"); // automatically jumps to main. php
}
Else {
Echo "incorrect user name or password ";
}
?>
The error message is as follows: NOtic: Undefined inder: passcode in C: \ wamp \ www \ ti \ index. php on line 8.
NOtic: Undefined inder: passcode in C: \ wamp \ www \ ti \ index. php on line 9
NOtic: Undefined inder: passcode in C: \ wamp \ www \ ti \ index. php on line 10
But it's strange that my classmates are exactly the same as me. they can run, but I can't. I can copy them. I can't do it on my computer, and I can't do it on my computer room!
------ Solution --------------------
Http://m.baidu.com/from=844b/bd_page_type=1/ssid=0/uid=wapp_1346730378276_172/pu=sz%401320_1001%2Cusm%400/w=0_10_Undefined+inder/t=iphone/l=3/tc? Bytes
What the mobile browser looks at is related to the configuration.
------ Solution --------------------
This is the feature of the new version of php. you can check the basic issues of the top article.
Add if (isset ($ passcode) {before the variable and continue the operation so that no prompt is displayed.
------ Solution --------------------
Of course, you can set the error display level of php. ini to disable the prompt, but I do not recommend this.
------ Solution --------------------
$ Passcode = $ _ POST ['passcode']; do you not have this field name, and you must judge them before using $ passcode. if it is null, it is empty (), or whether isset () exists ()
------ Solution --------------------
$ Username = $ _ POST ['username'];
$ Passcode = $ _ POST ['passcode'];
$ Cookie = $ _ POST ['cooker'];
This value is available only when the form is submitted in post mode.
When running independently, an error is reported because it does not exist.
You can ignore it or use it.
If ($ _ SERVER ['request _ method'] = "POST "){
// Your code
}
Package
------ Solution --------------------
Php. ini configuration
Error_reporting = E_ALL &~ E_NOTICE