The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> syntax error, mariadb syntax
srwright
post Sep 10 2014, 04:22 PM
Post #1





Group: Members
Posts: 2
Joined: 10-September 14
Member No.: 21,532



Hi all.

I have changed hosting providers.

i have a contact form. which on form submit runs php code to add the message to the database.

when i submit the form i get this error.

"You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ')' at line 2"


CODE
<?php
include 'db.php';
// Enter info into the Database.
$message = htmlspecialchars($message);
$sql = mysql_query("INSERT INTO mail (name, email, phone, message)
        VALUES('$name', '$email', '$phone', '$message',)") or die (mysql_error());

if(!$sql){
    echo 'There has been an error sending your message. Please contact the webmaster.';
} else {
    //Mail us
    $emailcontent=" From: $name \n Phone: $phone \n Message: $message";
    $recipient = "info@pcremedyservices.com";
    $mailheader = "From: $email \r\n";
    mail($recipient, $emailcontent, $mailheader) or die("Error!");
    // Let's mail the user!
    $replysubject = "Your PC Remedy Services";
    $replymessage = "Dear $name,
    
    This is an automated response from your local PC Remedy Services.
    
    Thank you for contacting us with your technical difficulties,
    
    A member of staff will get back to you as quickly as possible.
    
    Best regards
    PC Remedy Services
    Stephen Smith
    
    This is an automated response, please do not reply!";
    
    mail($email, $replysubject, $replymessage, "From: info@pcremedyservices.com \r\n" . phpversion());
    print '<script type="text/javascript">';
    print 'alert("Your request for support has been mailed, please check your email for confirmation and replies. Please allow 12 hours for a reply.")';
    print '</script>';
}
?>


This is my send_mail script that is run when i submit the form.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
srwright
post Sep 10 2014, 04:42 PM
Post #2





Group: Members
Posts: 2
Joined: 10-September 14
Member No.: 21,532



sry all sorted it out..

stray comma lol
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 23rd April 2024 - 06:20 AM