How to tell if the user name and password are empty do not execute the following SQL statement
Beginners to consult, the purpose is to determine the form came over the data, if the blank prompt for the user and password, and do not execute down the SQL, if the form inside the data has a value to execute the following SQL statement, here first do not determine whether the form data is legitimate and so on.
$user =$_post[name]; Get the name of the form
$pwd =$_POST[PASSWD]; Get the form's passwd
if ($user = = ' && $pwd = = ') { //This place I do not know can be judged, if the user is equal to null, prompt for password
Echo ' Please enter user and password ';
}else{ //If the above two is not empty, execute the following SQL statement and insert it into the database.
$sql = "INSERT INTO (' $user ', ' $pwd ')";
mysql_query ($sql);
}
Share to:
------Solution--------------------
if ($user = = "&& $pwd = =") {//used here
------Solution--------------------
better.
------Solution--------------------
if (Empty ($use)
------Solution--------------------
Empty ($pwd)) {
}