I keep getting this error from a working script since using Mysql 5.1 This data from the formshould go to the database with table called users and also sendconfirmation email with the details on using regmail. This works on other site but have to use 5.1 for this site and error is doing my head in
THE ERROR MESSAGE
Error: 1064:- 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 'VALUES ('', '', '', '', '', '8am-10am ', '', '', '', '', '', ''
THE SIDE SCRIPT
<?php
ob_start();
session_start();
// include section
define('DIR', '.');
include(DIR."/includes/phpclass.inc.php");
include(DIR."/includes/functions.php");
$db = new PHP_fun(); // object for php class
extract($_REQUEST);
$s_chk = "select * from users where username = '".$username."' ";
$r_chk = $db->select_row($s_chk);
if (count($r_chk) == 0)
{
$s_ins = "INSERT INTO `users` (`firstname` , `familyname` , `email` , `address` , `phone` , `besttime` , `resortname` , `joindate` , `whatyouown` , `timeofuse` , `price` , `tradein` , `deposit` , `balance` , `method` , `cancel` , `whathappened` , `creditcard` , `whattheysaid` , `username` , `passwd` , `passwdhint` , `answer`) VALUES ('".$name."', '".$email."', '".$address."', '".$telephone."', '".$bestcontacttime."', '".$wherejoin."', '".$joindate."', '".$membershiplength."', '".$iac_number."', '".$username."', '".$passwd."', '".$passwdhint."', '".$answer."', NOW())";
$r_ins = $db->insert_row($s_ins);
if ($r_ins > 0)
{
ob_start();
include("regmail.php");
$message = ob_get_contents();
ob_end_clean();
$to = "register@mysite.com";
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'From: '.$name.' <'.trim($_REQUEST['email']).'>' . "\r\n";
$subject = "New TRP Registration" ;
$sent = mail($to, $subject, $message, $headers);
if ($sent)
{ print ""; }
}
?>
<script language="javascript">
alert("TRP web user Registration Successfully please wait for member services to confirm and activate your account.");
window.location = 'thankyou.htm';
</script>
<?
}
else
{ ?>
<script language="javascript">
alert("A member with TRP already has that username");
window.location = 'register.htm';
</script>
<?
}
?>