i am trying to store user records into my table user , there is a strange problem happening right now which all data is stored but not the address record.
here is my form code
function RegisterUser($firstName,$LastName,$Gender,$Address,$phoneNumber,$mobileNumber,$facebookAccount,$userName,$password,$emailAddress) {
$dob = $_POST['Year'] . '-' . $_POST['Month'] . '-' .$_POST['Day'];
$insertVisitor = "INSERT INTO user (userFirstName,userLastName,userDateOfBirth,userGender,userAddress,userPhoneNumber,userMobileNumber,userFacebookAccount,userUserName,userPassword,userEmailAddress) VALUES ('$FirstName','$LastName','$dob','$Gender','$Address','$phoneNumber','$mobileNumber','$facebookAccount','$userName','$password','$emailAddress')";
mysql_query("$insertVisitor") or die (mysql_error());
}
i made sure of the following
-
the form
field addressistextareaand the same name is variable$Addresson my action file. -
in mysql database , the record userAdddress is text type and has default 0 length.
what is it i did wrong ?
You are referring to
$addressin the SQL, while the parameter says$Address.Variables are case-sensitive.
Quick note (possible mysql-injection aside):
$insertVisitoris already a string, so you don’t have to quote it again: