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 events( id int primary key auto_increment, event_time timestamp, event_value int );

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

Copy Clear
Copy Format Clear
<?php for ($i=0; $i<3; $i++) { $dddt = rand(1,15); $insert_sql = "INSERT INTO events SELECT MAX(id) + {$dddt}, NOW(), 10 FROM events;"; mysqli_query($mysqli, $insert_sql); } // Run query using mysqli $result = $mysqli->query("SELECT * FROM events"); $rows = $result->fetch_all(); print_r($rows);
Copy Clear