gpt4 book ai didi

php - fatal error : Uncaught PDOException: SQLSTATE[42000]:?

转载 作者:太空宇宙 更新时间:2023-11-03 10:31:25 25 4
gpt4 key购买 nike

<分区>

我正在尝试通过搜索构建一个无限滚动。到目前为止,我遇到了这个问题:

Fatal error: Uncaught PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DESC LIMIT 0, 4'.

谁能帮我解决这个问题?

if(isset($_GET["starts"], $_GET["limits"])){
$search = htmlspecialchars($_GET['Search'],ENT_QUOTES,'utf-8');
$start = htmlspecialchars($_GET['starts'],ENT_QUOTES, 'utf-8');
$limit = htmlspecialchars($_GET['limits'],ENT_QUOTES, 'utf-8');
$stmt = $conn->prepare("SELECT `jobtitle`, `company`, `location`,
`employment`, `email`, `Description` FROM `featured job` WHERE jobtitle LIKE
`:jobtitle` DESC LIMIT :starts, :limits");
$stmt->bindParam(":starts", intval(trim($start)), PDO::PARAM_INT );
$stmt->bindParam(":limits", intval(trim($limit)), PDO::PARAM_INT );
$stmt->bindParam(":jobtitle",$search);
$stmt->execute();
foreach ($posts as $data) {
echo "<h2>".$data['jobtitle']."</h2>";
}

这是我的ajax代码

  $(document).ready(function(){
var limits = 4;
var starts = 0;

var action = 'inactive';
function load_job_data(limits, starts)
{
$.ajax({
url:"load_more.php",
method:"GET",
data:{limits:limits, starts:starts},
cache:false,
success:function(data)
{
$('.results').append(data);
if(data == '')
{
$('#load_data_messages').text("Your potential jobs is loading");
$('#load_data_messages').css("color", "green");

action = 'active';
}
else
{
$('#load_data_messages').text("Out of jobs! please come back later!");
$('#load_data_messages').css("color","red");
action = "inactive";
}
}
});
}

if(action == 'inactive')
{
action = 'active';
load_job_data(limits, starts);
}
$(window).scroll(function(){
if($(window).scrollTop() + $(window).height() > $(".load_data").height()
&& action == 'inactive')
{
action = 'active';
starts = starts + limits;
setTimeout(function(){
load_job_data(limits, starts);
}, 1000);
}
});

});

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