Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7586203
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T19:22:07+00:00 2026-05-30T19:22:07+00:00

ill try again :/ im setting up a blog page, i want it to

  • 0

ill try again :/

im setting up a blog page,

i want it to show posts via, poster or catagory or month or year, or a combination.
but only if the $_GET is in the url. if not and they just go to blogs.php i want it to just show the 12 most recent posts. no i have the catagory working on its own and poster working on its own.

here is my code so far, after editing it out a bit

                    <?php 


$category = mysql_real_escape_string( $_GET['Category']);
$Poster = mysql_real_escape_string($_GET['Poster']);
$Month = mysql_real_escape_string($_GET['Month']);
$Year = mysql_real_escape_string($_GET['Year']);


$sql = "SELECT * FROM blog, blog_poster, blog_category WHERE blog.category = '$category' 
AND  blog_poster.pid = blog.posterid 
AND blog_category.ID = blog.category 

OR posterid = '$Poster' 
AND  blog_poster.pid = blog.posterid 
AND blog_category.ID = blog.category  
ORDER BY timestamp DESC LIMIT 5";

$result = mysql_query($sql) or print ("Can't select entries from table.<br />" . $sql . "<br />" . mysql_error());
while($row = mysql_fetch_array($result)) {
    $date = date("D M d Y", $row['timestamp']);

$title = stripslashes($row['title']);
$entry = stripslashes($row['entry']);
$id = $row['id'];
$entry =substr($entry, 0, 250);


?>

            <div class="ribbon">
                    <div class="wrapAround"></div>
                    <div class="tab">
                        <span class="blogDate"><?php echo $date; ?></span>
                        <span class="blogPostInfo">Posted by <a href="#"><?php echo $row['name']; ?></a> <!--|  <a href="#">0 Comments</a --></span>
                    </div>
                </div>
                <div class="blogPostSummary">
                    <h1><span><b><?php echo $title; ?></b></span></h1>
                    <div class="blogPostImage">
                        <a href='cs_blog/content.php?id=<?=$id?>'class="img">
                        <img src="../images/content/blogs/cs_blog/date/headers/blog-post-01.JPG" width="556" height="133" alt="blog post image" /></a>
                  </div>
                    <p>
                        <?php echo $entry."..&nbsp;<br><a href='content.php?id=$id'>Read more...</a>"; ?>
                    </p>
                    <p></p>
                </div>



                <!-- End of Content -->
                <?php }; ?>

ben

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T19:22:08+00:00Added an answer on May 30, 2026 at 7:22 pm
    $conditions = array();
    if( isset($_GET['Category']) ) $conditions[] = "category='". mysql_real_escape_string( $_GET['Category']) . "'";
    if( isset($_GET['Poster']) )   $conditions[] = "poster='". mysql_real_escape_string( $_GET['Poster']) . "'";
    
    if(!empty($conditions))
        $conditions = 'where ' . implode(' AND ', $conditions);
    echo 'select * from table ' . $conditions;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Probably this isn't the right place... but ill give it a try. I want
This will probably be a bot of a waffly question but ill try my
I really think that here ill found my answers... I try to make a
I'll try to explain shortly what I want to do: A project using a
I guess my description is not clear enough. So I'll try again: Imagine there
I'll try this again. I need help in getting a third option working using
Ill try to explain this as best I can. I have two web servers.
my last question was closed because it wasn't clear, so I'll try again because
I'll try to explain. I want to track dirty records in my dataset row
First of all I am not really good in english but Ill try to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.