【发布时间】:2021-05-13 20:28:30
【问题描述】:
我想用我的 php 代码执行一个 sql 查询,但它是错误的,我不知道我的问题是什么!
$end_type = $executed[end_type];
$start_type = $executed[start_type];
$sql = "SELECT * FROM `wants` WHERE ((`car`=? AND $start_type=? AND $end_type=?) OR (`car`=? AND $start_type=? AND $end_type='all'))";
$query = $con->prepare($sql);
$query->bindValue(1, $executed[car]);
$query->bindValue(2, $executed[start_place]);
$query->bindValue(3, $executed[end_place]);
$query->execute();
$results = $query->fetchall();
sendmsg($user_id, $results);
sendmsg 是我的按摩发送函数,它不返回任何数组,即使是空数组!
为什么?我的解决方案是什么?
【问题讨论】:
-
任何错误?使用
$con->error获取错误并回显它。 -
您的代码以其当前形式不会存储甚至转储
sendmsg()返回的值。执行是否到达那个函数?