zarath
zarath

Reputation: 13

How can I have my php return only a certain id from mysql

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>";
        }

        ?>

Upvotes: 1

Views: 84

Answers (1)

batoutofhell
batoutofhell

Reputation: 1309

$result = mysql_query("SELECT * FROM entries WHERE id=1");

Upvotes: 1

Related Questions