Jump to content


Photo

Please someone help me with this error


  • Please log in to reply
3 replies to this topic

#1 DarkHavn

DarkHavn
  • Members
  • PipPipPip
  • Advanced Member
  • 69 posts

Posted 21 August 2006 - 11:52 PM

What the hell is oing on, this is my following code



if($_POST['clientsubmit']){
connect(); //Connects to the database


$name = strip_tags($_POST['name']);
	$lname = strip_tags($_POST['lname']);
		$email = strip_tags($_POST['email']);
			$hphone = strip_tags($_POST['phone']);
		$cphone = strip_tags($_POST['cphone']);
	$password = md5($_POST['pass']);

//$insertquery = 'INSERT INTO agent (name, a_lname, email, phone, cell, pass) VALUES(' . "$name" . ',' . "$lname" . ',' . "$email" . ',' . "$hphone" . ',' . "$cphone" . ',' .  "$password" . ');';
$insertquery = "INSERT INTO agent (name, lname, email, phone, cell, pass) VALUES ($name, $lname, $email, $hphone, $cphone, '$pass');";
if(mysql_query("$insertquery")) {
	$_SESSION['success'] = "Thank you, your Agent has been Signed up";
	header("Location: ../thanks/thanks.php");
} else {

$error = mysql_error();
echo "$error";
	$ip = $_SERVER['REMOTE_ADDR'];
	$errormsg = "INSERT INTO information (error, ip) VALUES ($error, $ip);";
		mysql_query("$errormsg");
}


}

What the following does is just take simple input from a form and insert in into the mysql database, everything matches, the table names etc are correct, but everytime i go to submit it i get this error


"Unknown name in feildlist"  (The name being the section for the agents first name), but then it keeps jumping around, last night when i gave up and when to bed it was complaining that the md5() password wasn't in the feildlist???????


Please help me guys/girls? :(

#2 Corona4456

Corona4456
  • Members
  • PipPipPip
  • Advanced Member
  • 244 posts
  • LocationEl Paso, TX

Posted 21 August 2006 - 11:58 PM

Hard to debug this not knowing the tables but try doing this since you are sure the table names are exactly the same:

"INSERT INTO agent (`name`, `lname`, `email`, `phone`, `cell`, `pass`) VALUES ('$name', '$lname', '$email', '$hphone', '$cphone', '$pass')"

Not sure if that will fix it but I would check again and make sure that the field names are really in the table you are using.
What is the CoronaMatrix?

#3 DarkHavn

DarkHavn
  • Members
  • PipPipPip
  • Advanced Member
  • 69 posts

Posted 22 August 2006 - 12:05 AM

Well that did the trick, cheers for that, will remember to use that syntax for the sql insert.

Cheers mate you are a life saver :)

Now time to do some security on the forms

#4 Corona4456

Corona4456
  • Members
  • PipPipPip
  • Advanced Member
  • 244 posts
  • LocationEl Paso, TX

Posted 22 August 2006 - 12:12 AM

Glad it worked! :D
What is the CoronaMatrix?




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users