Skip to content

Instantly share code, notes, and snippets.

@mikestratton
Last active May 23, 2019 18:26
Show Gist options
  • Save mikestratton/d33a27d5f9b4878f5d871733b0aca648 to your computer and use it in GitHub Desktop.
Save mikestratton/d33a27d5f9b4878f5d871733b0aca648 to your computer and use it in GitHub Desktop.

Revisions

  1. mikestratton revised this gist May 23, 2019. 1 changed file with 4 additions and 1 deletion.
    5 changes: 4 additions & 1 deletion Access Raw Wordpress Post Data
    Original file line number Diff line number Diff line change
    @@ -1,10 +1,12 @@
    // Displays Wordpress posts, in raw data(HTML) format, pulling from the MySql / wp-posts table.
    <?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()) {
    @@ -14,4 +16,5 @@ if ($result->num_rows > 0) {
    echo "0 results";
    }
    $conn->close();

    ?>
  2. mikestratton created this gist May 23, 2019.
    17 changes: 17 additions & 0 deletions Access Raw Wordpress Post Data
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,17 @@
    // Displays Wordpress posts, in raw data(HTML) format, pulling from the MySql / wp-posts table.
    <?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();
    ?>