Mysql
 sql >> Database >  >> RDS >> Mysql

Non riesco ad accedere all'istanza PDO grezza in Laravel 5

   <?php
    
    namespace App\Http\Controllers\your_controller_path;
    
    use DB;// important
//then in
class your_controller extends Controller{
public function index(Request $request ){
    $pdo = DB::connection()->getPdo();
    $query=$pdo->prepare("SHOW TABLES");
    $query->execute();//$query->execute(array($bindings ));
    while($row=$query->fetch(\PDO::FETCH_BOTH)) {
        //Use \PDO::FETCH_ASSOC, \PDO::FETCH_OBJ    
        //echo $row->yourcolumnname;//its an object when \PDO::FETCH_OBJ
        echo $row[0]; //Indexed Array
                                    
    }
}