Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
dammyadey25
Starting Member
2 Posts |
Posted - 2014-10-01 : 17:39:40
|
Dear All, kindly help me out on this urgently. I actually wrote an sql script for my contact us page and got back this sql errors each time i try to fill in the form and click on submit button. You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-form ( name, email, telephone, subject, enquiry ) WHERE ('Johnson', 'dammyadey2' at line 1}Below is the code for easy referencing: if(isset($_POST['submit'])) { $errors = array(); $required_fields = array('name', 'email', 'telephone', 'subject', 'enquiry'); foreach($required_fields as $fieldname){ if(!isset($_POST[$fieldname]) || empty($_POST[$fieldname])){ $errors[] = $fieldname; } } $fields_with_lengths = array('name' => 30); foreach($fields_with_lengths as $fieldname => $maxlength) { if (strlen(trim(magic_quote($_POST[$fieldname]))) > $maxlength){ $errors[] = $fieldname;} } if (empty($errors)){ //perform the update $id = magic_quote($_GET['id']); $name = magic_quote($_POST['name']); $email = magic_quote($_POST['email']); $telephone = magic_quote($_POST['telephone']); $subject = magic_quote($_POST['subject']); $enquiry = magic_quote($_POST['enquiry']); $query = "INSERT INTO contact-form (name, email, telephone, subject, enquiry) WHERE ('$name', '$email', '$telephone', '$subject', '$enquiry' )";$result = mysql_query($query, $db_connect); if ($result) { //redirecting to login page. mail("info@dynamicanchor.com",$name,$email, $telephone,$subject,$enquiry,"From: $from\n"); echo "Thank you for Contacting Dynamic Management Services (DMS). Your request will be attended to shortly!"; exit;}else { echo "<p> Error sending your message please try again latter. SERVER BUSY </p>";}Kindly help me out as i needed to submit this to my superior in less than 8 hours now...Thank you.Regards,Dammyadey25 |
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2014-10-01 : 17:40:50
|
Hi Dammyadey25, SQLTeam.com is for Microsoft SQL Server. You'll likely get better help if you posted your question on a site that specializes in MySql.Tara KizerSQL Server MVP since 2007http://weblogs.sqlteam.com/tarad/ |
|
|
dammyadey25
Starting Member
2 Posts |
Posted - 2014-10-01 : 18:05:05
|
Hello Tara. Thank you for your prompt response. please do you have an idea of the sites that specializes in MYSQL??? |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2014-10-01 : 18:06:11
|
https://www.google.com/webhp?sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8#q=mysql%20forumTara KizerSQL Server MVP since 2007http://weblogs.sqlteam.com/tarad/ |
|
|
|
|
|
|
|