$ mysql-> information returns nothing

$db = new mysqli('localhost','x','x','rock');

$q = $db->query("INSERT INTO names (name,surname) VALUES ('jack','daniel')");

var_dump($q); // boolean true

echo $db->info;

do everything as described in the manual, but returns nothing.

+3
source share
1 answer

If the operator insertis one of the following info, the function returns the result

INSERT INTO...SELECT...     
INSERT INTO...VALUES (...),(...),(...)  

And your insertion does not satisfy this condition.

you have

INSERT INTO names (name,surname) VALUES ('jack','daniel')

if you change this value to insert more than one record, you will see the result from the function info

if you change the insert request to insert multiple records as soon as you get the result

Try below

INSERT INTO names (name,surname) VALUES ('jack','daniel'),('jack2','daniel2')

+2
source

All Articles