Jump to content

Archived

This topic is now archived and is closed to further replies.

DarkHavn

Please someone help me with this error

Recommended Posts

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


[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");
}


}
[/code]

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? :(

Share this post


Link to post
Share on other sites
Hard to debug this not knowing the tables but try doing this since you are sure the table names are exactly the same:

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

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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.