Hi! Could we please enable some services and cookies to improve your experience and our website?
Online Sandbox for SQL and PHP: Write, Run, Test, and Share SQL Queries and PHP Code
use sakila;
select * from actor;
<?php
$data = [
'where' => [
'first_name', '=', 'NICK'
],
];
$query = sprintf(
'select * from sakila.actor where `%s` %s ? ;',
$data['where'][0],
$data['where'][1]
);
echo $query;
// get DB version using PDO
$stmt = $pdo->prepare($query);
$stmt->execute([$data['where'][2]]);
$actors = $stmt->fetchAll(PDO::FETCH_ASSOC);
print_r($actors);