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