我会直接进入主题:
Mysql数据库 表名 = mycars_gallery
|id| car_id|img_thumb |img_link |
-----------------------------------
|5 | 3 |thumb1.jpg|image1.jpg|
|6 | 3 |thumb2.jpg|image2.jpg|
|7 | 3 |thumb3.jpg|image3.jpg|
I have 2 classes:
Upload.class.php
class Upload
{
function __construct()
{
// nothing
}
function deleteCarImgs($car_id,$arr_imgids)
{
//weld all img ids and separate by commas
$img_ids = implode(",",$arr_imgids);
$sql = "SELECT img_link, img_thumb ";
.= "FROM mycars_gallery WHERE car_id = :carid AND id IN(:imgids);";
$params = array(
":carid" => $car_id,
":imgids" => $img_ids
);
//DB processing happens in Database class(100% working)
$dbconn = new Database;
$rows = $dbconn->dbProcess($sql, $params); //doesnt run
}
}
Cars.class.php
class Cars
{
function __construct()
{
// nothing
}
function deleteCompleteCar(3)//car_id is 3
{
$upload = new Upload();
$arr_imgids = array(5,6,7);//these are img_id = 5,6,7 the ones I want to select
$res = $upload->deleteCarImgs($id,$arr_imgids);
var_dump($res);
}
}
var_dump消息:
PDOStatement Object ( [queryString] => SELECT img_link, img_thumb FROM mycars_gallery WHERE car_id = :carid AND id IN(:imgids); )
我需要的是: 所有其他功能都正常工作,但对于这些特定的类,似乎出现了问题。没有任何错误发生。当我使用vardump时,只有查询出现,而不是获取图像链接和缩略图。我有一种感觉,这与两个类相互作用有关。
我已经做的事: 1. 我已经直接运行了sql查询多次,它有效。 2. 我通过其他类运行数据库PDO函数,它有效。 3. 我还尝试了摆脱implode()并将单个数字字符串'7'传递给:imgsid token,但仍然没有运气,它实际上返回了NULL,而不是PDO对象。
非常感谢您的帮助。