Why does it now work. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Why does it now work.

<?php function result ($resolution) { while ( ( $qator = $resolution->fetch_assoc()) === true) { print_r ($qator); echo "<br>"; } } $mysqli = new mysqli("localhost", "root", "12182001", "my_base") or die("Connection error"); $mysqli->query ("SET NAMES 'utf8'"); $resolution = $mysqli->query ("SELECT * FROM 'user'"); result ($resolution); $mysqli->close (); ?> error ------------------------------- Call to a member function fetch_assoc() on boolean in C:\wamp64\www\test\testing.php on line 3 -------------------------------

21st Aug 2017, 4:24 PM
Nodirbek
2 Answers
+ 5
fetch_assoc() fetch the value from the database table. There is no need to check at that point whether the value is present or not, plus, the === operator is inappropriate because it checks whether the data inside table is available as well as true (boolean).
21st Aug 2017, 4:43 PM
Sachin Artani
Sachin Artani - avatar
+ 1
what do you see? what is the error?
21st Aug 2017, 12:32 PM
Daniel
Daniel - avatar