Error php cannot display data?

Hi. Here's a code.
5a72d81eae229472685462.png
That's the mistake.

Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in D:\PROJECTS\myproject_new\OpenServer\domains\dsdsfsd\index.php on line 110

Recently started watching videos on php and there as always everything went smoothly no problems whatsoever. There really mysql_ and mysqli_ I have to redo it and it came across an error.
June 8th 19 at 17:01
3 answers
June 8th 19 at 17:03
Solution
if (!$result) {
 printf("Errormessage: %s\n", mysqli_error($connect));
}
this thing prints out :
Errormessage: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'table' at line 1 - Hosea_Hans commented on June 8th 19 at 17:06
the table exist at all? - Dominic_Ja commented on June 8th 19 at 17:09
Oh God. I found the problem)) it was the fact that the name "table" is reserved. changed to table_t - it worked! thank you. - Hosea_Hans commented on June 8th 19 at 17:12
you could modify the query as follows:

SELECT * FROM `table`

In this case, the rename table is not necessary.

P. S. Instead, the mysqli is better to use PDO. - Aryanna95 commented on June 8th 19 at 17:15
June 8th 19 at 17:05
you have the connection, the code should be
if (!$connect) {
echo 'Can\'t connect to database. Err: '.mysqli_connect_error();
exit;
}


1) in the condition must be manual shutdown die, exit, trigger_error, or exception, otherwise your code will run on and will continue to crumble Warning

2) you should use mysqli_connect_error() instead of mysqli_error()
connection I did a test. all is well - Hosea_Hans commented on June 8th 19 at 17:08
June 8th 19 at 17:07

Find more questions by tags PHP