Hi! Could we please enable some services and cookies to improve your experience and our website?

PHPize Online / SQLize Online  /  SQLtest Online

A A A
Login    Share code      Blog   FAQ

Online Sandbox for SQL and PHP: Write, Run, Test, and Share SQL Queries and PHP Code

Copy Format Clear
show tables;

Stuck with a problem? Got Error? Ask AI support!

Copy Clear
Copy Format Clear
<?php error_reporting(E_ALL); $sql = <<<SQL SELECT c1, c2, c3 FROM ( VALUES ROW('ID-1', 'Value 1', null), ROW('ID-2', 'Value 2a', 'v2a'), ROW('ID-2', 'Value 2b', 'v2b'), ROW('ID-3', 'Value 3', 'v3') ) AS t (c1, c2, c3); SQL; $result = $pdo->query($sql); print_r($result->fetchAll(PDO::FETCH_UNIQUE | PDO::FETCH_ASSOC)); /* $query = "SELECT VERSION() as version;"; // get DB version using PDO $stmt = $pdo->prepare($query); $stmt->execute(); $row = $stmt->fetch(PDO::FETCH_ASSOC); printf('DB version (PDO): %s ' . PHP_EOL, $row['version']); */
Copy Clear