R
R
Roman Radic2016-01-31 21:19:04
PHP
Roman Radic, 2016-01-31 21:19:04

Why is mysqli_fetch_all function not returning anything?

I'm very, very asking for help. I've already broken my brain. Here is the tutorial code.

$link = mysqli_connect(DB_HOST,DB_LOGIN,DB_PASS,DB_NAME) or die(mysqli_connect_error());
$sql = 'SELECT id, name, email FROM catalog' ;
$result = mysqli_query($link,$sql);
$items = mysqli_fetch_all($result,MYSQLI_ASSOC);
mysqli_free_result($result);

echo var_dump($result);

In theory, an associative array should return, but for some reason, nothing is returned and var_dump is not displayed.
When using the mysqli_fetch_assoc function, everything outputs fine.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey, 2016-01-31
@user28

Check your php version. Must be 5.3 or higher.
Well, MySQL Native Driver is needed

M
Muhammad, 2016-01-31
@muhammad_97

echo var_dump($result);
Your code is interesting) Is error display enabled?
error_reporting(E_ALL);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question