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
https://forums.phpfreaks.com/topic/190824-sql-query-for-retrieving-todays-date/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.