Jump to content

SQL Query for retrieving todays date


bobicles2

Recommended Posts

I have this code

 

<?php

            $sql="select * from Events where issue = (select max(issue) from jfs);";

       

            $result_set = pg_Exec ($conn, $sql);

            $rows = pg_NumRows($result_set);

 

            if ((!$result_set) || ($rows < 1)) {

                  echo "<H1>ERROR - no rows returned</H1><P>";

                  exit;  //exit the script

                  }

 

            $previous_issue = "";

            for ($j=0; $j < $rows; $j++)

              {

              $issue = pg_result($result_set, $j, "issue");

$page = pg_result($result_set, $j, "page");

              $author = pg_result($result_set, $j, "author");

               

              $title = pg_result($result_set, $j, "title");

 

              $url = pg_result($result_set, $j, "url");

       

?>

 

That pulls up "todays issue" from the table...but im looking to change it so that it pulls up items in the database with todays date.

 

i.e - an issue with the date 15/02/10 would be displayed on the screen on that date only...

 

  $sql="select * from Events where issue = (select max(issue) from jfs);";

 

i know its the above part i need to alter but im not really sure how :( If anyone has any other advice id be grateful im doing this for a school project so im aware its very basic but i honestly appreciate all advice as for me its all part of the learning curve and im keen to improve!

 

 

Thanks in advance

Rob

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.