Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Notice: Undefined variable: results in C:xampphtdocsTest WebsiteIncludesdatabaseconnect.php on line 25
- $dbServername = "localhost";
- $dbUsername = "root";
- $dbPassword = "";
- $dbName = "phplessons";
- $conn = new mysqli($dbServername, $dbUsername, $dbPassword, $dbName);
- if ($conn->connect_errno) {
- printf("Connection failed %sn", $conn->connect_error);
- exit();
- }
- $id = 8;
- $stmt = $conn->prepare("Select * FROM posts WHERE ID=?");
- $stmt->bind_param("d", $id);
- $stmt->execute();
- $result = $stmt->get_result();
- while ($row = $result->fetch_object()) {
- $results[] = $row;
- }
- print_r($results);
- ?>
Add Comment
Please, Sign In to add comment