我無法弄清楚爲什麼我在我的代碼中得到這個錯誤。任何人都可以幫我解決這個問題嗎?解析錯誤:語法錯誤,意外的T_STRING在43行C: ... GuestbookPHP.php
只是爲了讓你知道,我的第43行是
INSERT INTO commentList
<?php
$dbServer='localhost';
$dbUser='root';
$dbPass='password';
$dbName='Guestbook';
mysql_connect("$dbServer", "$dbUser", "$dbPass") or die(mysql_error());
mysql_select_db("$dbName") or die(mysql_error());
mysql_query("CREATE TABLE commentLlist(
id INT NOT NULL AUTO_INCREMENT,
PRIMARY KEY(id),
name VARCHAR(30),
comment VARCHAR(160))")
or die(mysql_error());
// Retrieving data from the url
$name = $_GET['name'];
$comment = $_GET['comment'];
if ($name != null && $comment != null) {
INSERT INTO commentList
VALUES("$name", "$comment");
} else if ($name == null) {
INSERT INTO commentList
VALUES("Anonymous", "$comment");
} else if ($comment == null) {
INSERT INTO commentList
VALUES("$name", " has nothing to say!");
$display_string = "<li>";
$display_string .= "$name";
$display_string .= " says";
$display_string .= "$comment";
$display_string .= "<li>";
echo $display_string;
?>
當出現錯誤時,評論和姓名字段的內容是什麼?它是一直髮生的,還是隻發生在某些評論上?這是一個品牌博客軟件,或家庭釀造? – Drazisil
作爲一個方面說明,你的表叫做commentLlist,而不是commentList – Joe