gpt4 book ai didi

php - SQLSTATE[42S02] 错误提示未找到基表或 View 1146

转载 作者:行者123 更新时间:2023-11-29 10:03:01 25 4
gpt4 key购买 nike

<?php
$assignmentsTable = $ssubjectnamewithoutspace.'_assignments';

try {
$stmt = $db->query('SELECT contentID, contentTitle,contentAuthor, contentLink FROM .$assignmentsTable ORDER BY contentID ASC');
while($row = $stmt->fetch()){

echo '<tr><td><a href="'.$row['contentLink'].'">'.$row['contentTitle'].'</a></td></tr>';


}

} catch(PDOException $e) {
echo $e->getMessage();
}
?>

我收到此错误

SQLSTATE[42S02]: Base table or view not found 1146 Table 'epiz_5453564654654_newdata.$assignmentsTable' doesn't exist

但是表存在于数据库中,当我替换 $assignmentsTable 时使用表名它可以工作...

最佳答案

您的查询中不会评估$assignmentsTable。

尝试:

$stmt = $db->query('SELECT contentID, contentTitle,contentAuthor, contentLink FROM `'.$assignmentsTable.'` ORDER BY contentID ASC');

关于php - SQLSTATE[42S02] 错误提示未找到基表或 View 1146,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52514210/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com