PHPize Online / SQLize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
show tables
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 = "CREATE TABLE test ( id INT PRIMARY KEY AUTO_INCREMENT, name VARCHAR(20), value INT )"; // Run query using mysqli $result = $mysqli->query($query); $q="INSERT INTO test (`name`,`value`) values ('test1',1),('test3',3),('test4',4)"; $result = $mysqli->query($q); if($result){ $first_id = $mysqli->insert_id; // Number of rows inserted $num_rows_inserted = $mysqli->affected_rows; $inserted_ids =range($first_id, $first_id + $num_rows_inserted - 1); print_r($inserted_ids); }
Show:  
Copy Clear