致命错误:带有消息的未捕获异常'PDOException' 'SQLSTATE [42000]:语法错误或访问冲突:1064您有 SQL语法错误;查看与您的手册相对应的手册 MySQL服务器版本,用于在':member'附近使用正确的语法。
这是因为我在第28-30行手动设置'id'吗?我一直在撞墙试图弄明白,任何帮助都会非常感激!
<?php
echo'<h3 class="panel-title"><a href="people.php?id=faculty">Faculty</a></h3>';
echo'<h3 class="panel-title"><a href="people.php?id=student">Students</a></h3>';
echo'<h3 class="panel-title"><a href="people.php?id=alum">Staff</a></h3>';
?>
</div>
</div>
</div>
<!-- vvvvvvvvvvvvvv-FACE OF THE ORG-vvvvvvvvvvvvvv -->
<div class="col-sm-10">
<div class="row">
<?php
if(!isset($_GET['id'])){
$stmt = $pdo->query("SELECT first_name, last_name, department, website, filename, membership
FROM Profile");
while ( $row = $stmt->fetch(PDO::FETCH_ASSOC) ){
echo '<div class="col-sm-3">
<img class="img-rounded" src="'.$row['filename'].'"/>
<p class="caption">';
echo '<a href="'.htmlentities($row['website']).'" target="_blank">'.$row['first_name'].' '.htmlentities($row['last_name']).'</a>';
echo ', '.htmlentities($row['department']);
echo '</p> </div>';
}
答案 0 :(得分:0)
您需要添加代码而不是图片,以便我们更好地为您提供帮助。我在这里看到的是您使用map
代替$pdo->query
来准备语句。修复如下:
$pdo-prepare