Level 122
I do love it when people come on a Laravel forum and post PHP code from 2005.
am using sqlite3, and when I want to insert data to the DB it give me this error
SQLSTATE[HY000]: General error: 1 near ")": syntax error
please can anyone help me
here is my insert code
<?php
try{
$db = new PDO('sqlite:./db/survey.sqlite3');
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$sql = " INSERT INTO survey (
fullname,
form,
phoneumber,
emailaddress,
topichated,
difficulttopic,
likemathstipice,
strugglingtopic,
enjoymathstopic,
challenges,
country,
city,
)
VALUES ('$_POST[fullname]',
'$_POST[form]',
'$_POST[phoneumber]',
'$_POST[emailaddress]',
'$_POST[topichated]',
'$_POST[difficulttopic]',
'$_POST[likemathstipice]',
'$_POST[strugglingtopic]',
'$_POST[enjoymathstopic]',
'$_POST[challenges]',
'$_POST[country]',
'$_POST[city]',
) ";
// use exec() because no results are returned
$res = $db->exec($sql);
echo "New record created successfully";
}
catch(PDOException $e)
{
echo $sql . "<br>" . $e->getMessage();
}
$res = null;
?>
Please or to participate in this conversation.