hello there, i'm having a bit of trouble about this.
im making a regiter page for our project and im using PHP, and im having a little problem,

it says that: Could not execute the insert query.. but i got all my fields right?..

		$fname = $_POST['fname'];
		$lname = $_POST['lname'];
		$email = $_POST['email'];
		$user = $_POST['uname'];
		$pass = $_POST['pass'];	
		$mos = $_POST['Month'];
		$date = $_POST['day'];
		$yr = $_POST['year'];
		if($user =="" || $pass=="")
			echo "Either username or password field is empty.";
			echo "<br/>";
			echo "<a href='register.php'>Go back</a>";	
			mysql_query("INSERT INTO login (id,uname,pass,fname,lname,email,bmonth,bday,byear)) 
				values ('$user','$pass',$fname,$lname,$email,$mos,$date,$yr)",$conn)
			or die("Could not execute the insert query");

im using combo box for my month,date and year..that is for the birthdate

please help.. thanks in advance

Member Avatar

Some of the fields need to have quotes around them, e.g. '$fname','$lname','$email', possibly '$date'.

Also make sure you escape all variables with mysql_real_escape_string or check that they are integers with is_int() and that they fall within the expected range.

thank you.. :)
im still new to php that's y i overlooked some of the quotes... thanks again.. :)

Member Avatar

Ok ,mark the thread as solved - link below the edit box.