我得到這個錯誤...多條件Statment錯誤,有什麼問題
Parse error: syntax error, unexpected '{', expecting '(' in /home/content/s/k/y/skyview09/html/clients/Cheryl/admin/admin.php on line 122
試圖運行具有多個條件語句中的頁面(如,ELSEIF,否則)時。
說我搭售運行PHP的是:
<?php
if(isset($_GET['message'])){
echo "<p><font color='#fff'>Your update was successful!</font></p>";
}
require("includes/connection.php");
$article = (isset($_GET['article'])) ? $_GET['article'] : "1";
$page = (isset($_GET['page'])) ? $_GET['page'] : "1";
$nav = (isset($_GET['nav'])) ? $_GET['nav'] : "none";
if($nav != "none"){
$sql = "SELECT id, name, url, title content FROM nav WHERE id='$nav'";
$result = $conn->query($sql) or die('Something is wrong on the test.php...Check it OUT! admin page, navigation');
if($result){
$row = $result->fetch_object();
echo '<form method="post" action="update.php">';
echo '<input type="hidden" name="id" value="' . $row->id . '" />';
echo 'Name: <input type="text" name="name" value="' . $row->name . '" /><br>';
echo 'Url: <input type="text" name="url" value="' . $row->url . '" /><br>';
echo 'Title: <input type="text" name="title" value="' . $row->title . '" /><br>';
echo '<input type="submit" name="editLinks" value="Update Content" />';
echo '</form>';
}
} elseif {
$sql = "SELECT id, content FROM articles WHERE id='$article'";
$result = $conn->query($sql) or die('Something is wrong on the test.php...Check it OUT! admin page, articles');
if($result){
$row = $result->fetch_object();
echo '<form method="post" action="update.php">';
echo '<input type="hidden" name="id" value="' . $row->id . '"';
echo '<textarea name="content" cols="50" rows="15">';
echo $row->content;
echo '</textarea>';
echo '<input type="submit" name="editContent" value="Update Content" />';
echo '</form>';
}
}
else {
$sql = "SELECT id, content FROM pages WHERE id='$page'";
$result = $conn->query($sql) or die('Something is wrong on the test.php...Check it OUT! admin page, pages');
if($result){
$row = $result->fetch_object();
echo '<form method="post" action="update.php">';
echo '<input type="hidden" name="id" value="' . $row->id . '"';
echo '<textarea name="content" cols="50" rows="15">';
echo $row->content;
echo '</textarea>';
echo '<input type="submit" name="editContent" value="Update Content" />';
echo '</form>';
}
}
?>
我想最後的「其他人」的語句是在「elseif的」聲明的地方。而其他的是最後一個。我嘗試了一些解決方案,但沒有真正起作用。我不知道問題是什麼。
我想我已經找到了解決我的問題在做題,但不是他們不完全是我的問題。我將不勝感激。
您的代碼包含SQL注入漏洞! – 2010-11-04 14:55:20
@ Bernd:它呢?我不知道。我在哪裏以及如何解決它?謝謝 – gdinari 2010-11-04 21:31:24