PHPize Online / SQLize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
Copy Clear
Copy Format Clear
<?php mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT); $mysqli->query("create table temp (id int auto_increment primary key, name varchar(10))"); $mysqli->query("create table temp1 (id int)"); $con = $mysqli; $stmt=$con->prepare("insert into temp(name) values(?)"); $t="ABC"; $stmt->bind_param('s',$t); $stmt->execute(); $id = $stmt->insert_id; $stmt1=$con->prepare("insert into temp1 values(?)"); $stmt1->bind_param('i',$stmt->insert_id); $stmt1->execute(); $stmt1->bind_param('i',$id); $stmt1->execute(); echo json_encode($mysqli->query("select * from temp")->fetch_assoc()),"\n"; echo json_encode($mysqli->query("select * from temp1")->fetch_all()),"\n";
Show:  
Copy Clear