sql query isnt working
Posted: Tue May 03, 2011 9:46 am
i got error msg :"Database ERROR: 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 ')' at line 9"
im trying to insert data in mysql...the code is below....
$this->dblink() :i used to set my connection with mysql and choose my database...
similarly realescapestring function perform stripslash and mysql_real_escape_string function
function insertintodb()
{
$this->dblink();
$table1="member_signup";
$query = 'INSERT INTO ' .$table1.
'(EMAIL,FIRSTNAME,LASTNAME,SEX,DOB,COLLEGE,BRANCH,YSTART,YEND)VALUES(
"'.$this->realescapestring($_POST['emailid']). '",
"'.$this->realescapestring($_POST['fname']).'",
"'.$this->realescapestring($_POST['lname']).'",
"'.$this->realescapestring($_POST['dob']).'",
"'.$this->realescapestring($_POST['college']).'",
"'.$this->realescapestring($_POST['branch']).'",
"'.$this->realescapestring($_POST['ystart']).'",
"'.$this->realescapestring($_POST['yend']).'",)';
mysql_query($query,$this->conn_link);
if (mysql_error()) { print "Database ERROR: " . mysql_error(); }
return TRUE;
}
im trying to insert data in mysql...the code is below....
$this->dblink() :i used to set my connection with mysql and choose my database...
similarly realescapestring function perform stripslash and mysql_real_escape_string function
function insertintodb()
{
$this->dblink();
$table1="member_signup";
$query = 'INSERT INTO ' .$table1.
'(EMAIL,FIRSTNAME,LASTNAME,SEX,DOB,COLLEGE,BRANCH,YSTART,YEND)VALUES(
"'.$this->realescapestring($_POST['emailid']). '",
"'.$this->realescapestring($_POST['fname']).'",
"'.$this->realescapestring($_POST['lname']).'",
"'.$this->realescapestring($_POST['dob']).'",
"'.$this->realescapestring($_POST['college']).'",
"'.$this->realescapestring($_POST['branch']).'",
"'.$this->realescapestring($_POST['ystart']).'",
"'.$this->realescapestring($_POST['yend']).'",)';
mysql_query($query,$this->conn_link);
if (mysql_error()) { print "Database ERROR: " . mysql_error(); }
return TRUE;
}