F
F
Frank_Sidebottom2018-02-01 12:07:01
PHP
Frank_Sidebottom, 2018-02-01 12:07:01

php error unable to output data?

Hello. Here's the code.
5a72d81eae229472685462.png
Here is such an error.
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 I
recently started watching a video on php and as always everything works smoothly without any problems. There, the truth is mysql_ and I have to somehow redo it on mysqli_ and now I came across an error.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
Stimulate, 2018-02-01
@Frank_Sidebottom

if (!$result) {
    printf("Errormessage: %s\n", mysqli_error($connect));
}

V
Vitaliy Orlov, 2018-02-01
@orlov0562

your connection is not established, in the code it should be

if (!$connect) {
echo 'Can\'t connect to database. Err: '.mysqli_connect_error();
exit;
}

1) the condition must contain a shutdown instruction die, exit, trigger_error or exception, otherwise the code will continue to be executed and Warning will continue to pour
in 2) you must use mysqli_connect_error () instead of mysqli_error ()

V
Vasiliy_M, 2018-02-01
@Vasiliy_M

Use the class to work with MySql !

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question