I am trying to insert data into my database. When I execute the statement I get no errors in PHP. When I execute the sql statement in my mysql database I get the error: Unknown column 'test 'in field list
.
Here is the script that I use to insert data:
if($correct) {
$db = new PDO('mysql:host=localhost;dbname=db', 'root', '');
$query = "INSERT INTO scu(user_id, internal_id, name) VALUES (?, ?, ?)";
$stmt = $db->prepare($query);
$stmt->execute(array($_SESSION['user_id'], $internal_id, $name));
header("Location: ../succ.php");
I get the error when I execute the following statement:
INSERT INTO scu(user_id, internal_id, name) VALUES (1, 1, test)
Does someone know what is wrong with my script?