• Welcome to the Chevereto user community!

    Here users from all over the world gather around to learn the latest about Chevereto and contribute with ideas to improve the software.

    Please keep in mind:

    • This community is user driven. Be polite with other users.
    • We recommend purchasing a Chevereto license to participate in this community.
    • Purchase a Community Subscription to get even faster ticket response times.

Help me: Mysql connection dont work

Status
Not open for further replies.

Valerius

Chevereto Member
I have a problem with the connection to mysql. The following code I tried

route.comments.php

PHP:
<?php

$route = function($handler) {
try {
   
            // test id
            $m_id = '2';
           
           
           
            $db = DB::getInstance();
            $db->query('SELECT * FROM '.DB::getTable('comments').' WHERE id_post=:m_id');
            $db->bind(':m_id', $m_id);
            $db_c = $db->fetchAll();
           
            foreach($db_c as $db_a) {
                echo $db_a['comment'];
            }

        } catch(Exception $e) {
        G\exception_to_error($e);
    }
   
};

?>

With this code comes only blank page. What am I doing wrong?
 
Status
Not open for further replies.
Back
Top