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
create table table1 as select 'tree' as column1, 29012 as column2, 'foggy' as column3 union select 'tree', '203943', 'rainy'; select * from table1;

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

Copy Clear
Copy Format Clear
<?php use Carbon\Carbon; $now = Carbon::now()->format('d/m/Y'); printf("Today is %s\nCurrent PHP version: %s \n\n", $now, phpversion()); $query = 'SELECT column1, column2, column3 from table1 where column1 = "tree"'; // get DB version using PDO $stmt = $pdo->prepare($query); $stmt->execute(); $row = $stmt->fetchAll(PDO::FETCH_ASSOC); foreach ($row as &$rowvalue) { $rowvalue['column2'] = strval($rowvalue['column2']); } echo json_encode($row, JSON_PRETTY_PRINT);
Copy Clear