代碼給我解析錯誤這是給我一個解析錯誤
$sql = INSERT INTO 'tdrilslt_ramen'.'awnsers' ('name', 'choices');
整個代碼
<?php
include 'database.php';
try{
$name = $_POST['name'];
$sql = INSERT INTO 'tdrilslt_ramen'.'awnsers' ('name', 'choices');
$q = $conn->prepare($sql);
$q->execute(array(
':name '=> $name,
':choices ' => $choices));
}catch (Exception $e) {
echo "Data could not be retrieved from the database.";
exit;
}
?>
你看過PHP手冊的第一頁了嗎?字符串變量是如何定義和初始化的。 '$ sql =「INSERT INTO tdrilslt_ramen.awnsers(name,choices)」;' – Cheery 2014-10-20 20:46:06
'setAttribute(PDO :: ATTR_ERRMODE,PDO :: ERRMODE_EXCEPTION)'<=你需要那個。 – 2014-10-20 20:55:52