I am trying to make al the records in my database to a JSON format so i can use it in an app from me, but then i got this error <b>Fatal error</b>:  Call to a member function fetch_all() on boolean i have tried changing fetch_all to fetchall but it did not help. this is my code that i use:
<html>
    <body>
<?php
//Converting db values into json data
header('Content-type:application/json');
$conn = new mysqli('localhost','root','') or die(mysql_error());
$sql= 'SELECT * FROM wtd';
$rs=$conn->query($sql);
$data = $rs->fetch_all(MYSQLI_ASSOC);
echo json_encode($data);
?>
        </body>
</html>
I hope anyone can help me i am on a time limit. Thanks!
 
     
    