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 450463
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T21:52:17+00:00 2026-05-12T21:52:17+00:00

I am trying to list out all records from a database that have not

  • 0

I am trying to list out all records from a database that have not expired.

i have a jobs listing site being developed, i have code to grab all the ‘active’ job details from the database and list out.

$mysql = new mysqli(DB_SERVER, DB_USER, DB_PASSWORD, DB_NAME) or die('There was a problem connecting to the database');
$stmtJ = $mysql->prepare('SELECT id,jobtitle,vcref,jobtype,jobintro,closingdate FROM jobs WHERE active = 1');

$stmtJ->execute();
$stmtJ->store_result();
$stmtJ->bind_result($id,$jobtitle,$vcref,$jobtype,$jobintro,$closingdate);
$totalLiveJobs = $stmtJ->num_rows();

and is outputted like so:

<?php
while($row = $stmtJ->fetch()) :
echo("<p>job detail here</p>");
endwhile; 
?>

and i also have an ‘if statement’ snippet to see if the job has expired or not (i.e if expires {expires is a date yyyy-mm-dd} is greater than ‘$now’ it should not show up.

$expires = date('Y-m-d-H-i-s',strtotime("$closingdate 12:00:00"));

$now = date('Y-m-d-H-i-s');


if ($expires < $now) {

echo ("<h3>Live Jobs Here</h3> $expires");

} else {

echo ("<h3>Job Expired</h3> $now");

}

However, i’m having problems merging the two together with the main goal being all jobs that have not yet expired will be shown on the page, any jobs that have expired should not be shown on the page.

I am pulling my hair out here, any help welcome, any requests for further details i’ll respond as soon as i possibly can.

thx in advance

  • 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-12T21:52:18+00:00Added an answer on May 12, 2026 at 9:52 pm

    depending on your database structure, you could do

    SELECT * FROM jobs WHERE active = 1 AND closingdate >= NOW()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to find all records in database that have exactly the same set
I'm trying to pull out a list of table names from a MySQL database.
I have a C# List, that is filled from a database.. So far its
I'm trying to figure out how to list all files of an FTP folder
I am trying to figure out a query to retrieve list of categories that
I am trying to get a list of all objects in the database of
Currently I have filtered all the noise out of a subset from the last-fm
I'm trying to sieve out some common tag-combinations from a list of educational question
I've been trying to figure this problem out all morning. Tried some things from
I'm new to MVC. Trying out some sample code to list items from db.

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.