Skip to content

Instantly share code, notes, and snippets.

@mikestratton
Last active May 23, 2019 18:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mikestratton/d33a27d5f9b4878f5d871733b0aca648 to your computer and use it in GitHub Desktop.
Save mikestratton/d33a27d5f9b4878f5d871733b0aca648 to your computer and use it in GitHub Desktop.
<?php
//MySQL Database Connect
include 'dataconnect.php';
$wp_posts = "wp_posts";
$sql = "SELECT * FROM " . $wp_posts;
$result = $conn->query($sql);
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
echo "<h1>" . $row["post_title"] . "</h1> <p>". $row["post_content"] . "</p><br><hr><br>";
}
} else {
echo "0 results";
}
$conn->close();
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment