DarkHavn Posted August 21, 2006 Share Posted August 21, 2006 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? :( Link to comment https://forums.phpfreaks.com/topic/18251-please-someone-help-me-with-this-error/ Share on other sites More sharing options...
Corona4456 Posted August 21, 2006 Share Posted August 21, 2006 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. Link to comment https://forums.phpfreaks.com/topic/18251-please-someone-help-me-with-this-error/#findComment-78350 Share on other sites More sharing options...
DarkHavn Posted August 22, 2006 Author Share Posted August 22, 2006 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 Link to comment https://forums.phpfreaks.com/topic/18251-please-someone-help-me-with-this-error/#findComment-78353 Share on other sites More sharing options...
Corona4456 Posted August 22, 2006 Share Posted August 22, 2006 Glad it worked! :D Link to comment https://forums.phpfreaks.com/topic/18251-please-someone-help-me-with-this-error/#findComment-78358 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.