function readAll(){ // Connect to db global $connection; // make result global so you can use it in the other file global $result; $query = "SELECT * FROM USERS"; $result = mysqli_query($connection, $query); } // HTML FILE <?php readAll(); while ($row = mysqli_fetch_assoc($result)){ ?> <pre> <?php print_r($row); } ?> </pre>
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter