1

How can I have my php page only return rows with a certain id. I am working on a webpage set up like a blog, i post using mysql, i it to only show entries with the id of 1, so i don't have to worry about deleting old posts or having 100 posts on 1 page.

        <?php
        include ("includes/includes.php");

        $blogPosts = GetBlogPosts();

        foreach ($blogPosts as $post)
        {
            echo "<div class='post'>";
            echo "<h2>" . $post->title . "</h2>";
            echo "<p>" . $post->post . "</p>";
            echo "<br />";
            echo "<span>Posted By: " . $post->author . "&nbsp Posted On: " . $post->datePosted . "&nbsp Tags: " . $post->tags . "</span>";
            echo "</div>";
        }

        ?>
2
  • 2
    Post the code you have so far. Commented Oct 24, 2011 at 22:23
  • 1
    You can by using a SELECT query. For example: SELECT title, content, date FROM entries WHERE id = 1 Commented Oct 24, 2011 at 22:26

1 Answer 1

1
$result = mysql_query("SELECT * FROM entries WHERE id=1");
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.