Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

$mysql->info returns nothing

Tags:

php

mysqli

$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;

doing everything as described in manual but still returns nothing.

like image 588
markussss Avatar asked Dec 02 '25 06:12

markussss


1 Answers

If the insert statement is one of the below info function will return result

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

And your insert is not satisfying this condition.

you have

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

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

if you change your insert query to insert multiple record in once you will get result

Try with below

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

like image 161
Shakti Singh Avatar answered Dec 04 '25 22:12

Shakti Singh



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!