How to pass parameters to medoo action

public static function create($title, $content, $label_ids){

    self::$db->action(function($db){
        $db->insert("articles", [
            "title" => $title,
            "content" => $content,
            "created_at" => self::$t,
            "updated_at" => self::$t,
            "created_date" => self::$t_date,
            "updated_date" => self::$t_date,
        ]);
        $article_id = $db->id();
        $data = [];
        foreach(explode(",", $label_ids) as $id){
            $data[] = [
                "article_id" => $article_id,
                "label_id" => $id,
                "created_at" => self::$t,
                "updated_at" => self::$t,
                "created_date" => self::$t_date,
                "updated_date" => self::$t_date,
            ];
        }
        $db->insert("article_labels", $data);
    });
}

how to pass variables outside action

Jun.16,2022

function (...) Use (...) {...}

refer to PHP documentation: https://secure.php.net/manual...


MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b35e7f-4d66c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b35e7f-4d66c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?