Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // Turn off error reporting
- error_reporting(0);
- $host = "127.0.0.1";
- $dbuser = "root";
- $dbpass = "ascent";
- $dbname = "auth";
- $conn = mysqli_connect($host, $dbuser, $dbpass, $dbname);
- if (!conn){ // stop loading anything if there's no DB connection
- print("No database connection");
- exit(); // replace with a return if you want to send a message or something
- }
- if ($stmt = $conn->prepare("SELECT * FROM account")){ // check if we have a statement then continue
- //$stmt->bind_param("i", $status); - you don't need this line because you are not passing a variable and your function will crash
- $stmt->execute();
- //$stmt->bind_result($charname); you don't need this either cause you are not going to use this variable
- $stmt->store_result();
- if($stmt->num_rows > 0)
- echo $stmt->num_rows;
- $stmt->close(); //make sure you always close the statement after you are done
- }
- $conn->close(); //also you need to close the connection too
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement