Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_name("HELLO_SESSION");
- session_start();
- echo("Authenticating to the database...\n");
- $mysqli = new mysqli("host-mysql-db", "luckybyte", "Hjbbj86cX6Nw4QK3QQNnVPFpZrZh3kXm", "luckybyte");
- if ($mysqli->connect_error){
- die("Failed to authenticate to the database :( \n");
- }
- echo("Successfully authenticated! :) \n");
- $stmt = $mysqli->prepare("SELECT * FROM users;");
- $result = $stmt->execute();
- echo("Running SQL query SELECT * FROM users;\n");
- echo("\n");
- ///////////////////////////////////////////////////// NEW
- while ( $rows = $result->fetch_assoc() ) {
- print_r($rows);
- }
- ///////////////////////////////////////////////////// NEW
- echo("\n");
- echo("Trying to bind to variable (unsure if that is what works for MySQLi)\n");
- $stmt->bind_result($output);
- $stmt->fetch();
- print_r($output);
- $stmt->close();
- ?>
Advertisement
Add Comment
Please, Sign In to add comment