I'm gonna go straight to the point:
Mysql DB tbl = 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 message:
PDOStatement Object ( [queryString] => SELECT img_link, img_thumb FROM mycars_gallery WHERE car_id = :carid AND id IN(:imgids); )
What I need: All other functions are working correctly, but for this particular classes it seems to be broken. There are absolutely no errors that happen. Instead of getting the image links and thumbs, only query shows up when I use vardump. I have a feeling it has to do with 2 classes interacting with each other.
What I've already done:
- I've ran sql query directly many times, it works
- I ran Database PDO functions through other classes, it works
- I also tried to get rid of implode() and passing a single digit string '7' to :imgsid token, still no luck, it actually returned NULL, instead of the PDO obj
Thanks a lot in advanced.