I am trying to use MySQL CONCAT_WS in a PDO Prepared Statement. I tested the query inside of phpMyAdmin and it works perfectly but not in a PDO Prepared Statement.
Here is the phpMyAdmin query which gives me the result i am looking for.
SELECT CONCAT_WS(',', `forum_tags`) AS ftags FROM `forum_topics` WHERE `forum_id` > 0
And the result i am looking for
I am having difficulty replacating that in my PDO Prepared Statement. Here is my current PDO code
$zero = 0;
$sql = "SELECT CONCAT_WS(',', `forum_tags`) AS ftags FROM `forum_topics` WHERE `forum_id` > :z;";
$stmt = $this->pdo->prepare($sql);
$stmt->execute([
':z' => $zero
]);
$results = $stmt->fetch(); //also tried fetchAll() as a test
if(is_array($results))
{
return $results;
}//close if is array
return false;
What is the proper to way perform this with PDO Prepared Statement?
Thank you.
