Hi! i have problem.
I'm trying to convert:
$sql = "SELECT
categories.cat_id,
categories.cat_name,
categories.cat_description,
categories.forum_id,
COUNT(topics.topic_id) AS topics
FROM
categories
LEFT JOIN
topics
ON
topics.topic_id = categories.cat_id
WHERE categories.forum_id = '$id'
GROUP BY
categories.cat_name, categories.cat_description, categories.cat_id
";
to use in Medoo.
I wrote this:
$id = $forname['id'];
$sql = $database->select("categories", [
"[>]topics" => ["topics.topic_id" => "categories.cat_id"],
], [
"categories.cat_id",
"categories.cat_name",
"categories.cat_description",
"categories.forum_id"
], [
"categories.forum_id" => $id
]);
But I get an empty result. Normally I used "while". Now with Medoo I used foreach, I do not know how to use "while".
Hi! i have problem. I'm trying to convert: $sql = "SELECT categories.cat_id, categories.cat_name, categories.cat_description, categories.forum_id, COUNT(topics.topic_id) AS topics FROM categories LEFT JOIN topics ON topics.topic_id = categories.cat_id WHERE categories.forum_id = '$id' GROUP BY categories.cat_name, categories.cat_description, categories.cat_id "; to use in Medoo. I wrote this: $id = $forname['id']; $sql = $database->select("categories", [ "[>]topics" => ["topics.topic_id" => "categories.cat_id"], ], [ "categories.cat_id", "categories.cat_name", "categories.cat_description", "categories.forum_id" ], [ "categories.forum_id" => $id ]);
But I get an empty result. Normally I used "while". Now with Medoo I used foreach, I do not know how to use "while".