$w=$mysqli->query($sql);
1 $db = new mysqli('localhost', 'root', '', 'w'); 2 if($db->connect_error){ 3 die('Connect Error ( '.$db->connect_errno.' )'.$db->connect_error); 4 } 5 echo 'Connect OK.<br>'; 6 $wtab = 'w'.rand(123,987); 7 $w = $db->query("CREATE TABLE $wtab (w int)"); 8 var_dump($w); 9 $w = $db->query("INSERT INTO $wtab VALUES(123)"); 10 var_dump($w); 11 $w = $db->query("SELECT * FROM $wtab"); 12 var_dump($w);
Connect OK. D:\wamp64\www\wdb.php:21:boolean false D:\wamp64\www\wdb.php:23:boolean true D:\wamp64\www\wdb.php:25: object(mysqli_result)[3] public 'current_field' => int 0 public 'field_count' => int 1 public 'lengths' => null public 'num_rows' => int 2 public 'type' => int 0