I've got a problem with a page that I'm trying to create. What I am wanting to do is have 2 links that display the results of a sql query based on which one was clicked.
The first link would only display the current months news items and the second would display all news items.
Here's my php code so far in index.php
<?php
$user = "username";
$pass = "pass";
$db = "database";
$link = mysql_connect ("localhost", "username", "pass"
or die ("I cannot connect to the database because: ".mysql_error() );
if ( ! $link )
die( "Couldn't connect to the database" );
mysql_select_db ( $db )
or die( "Couldn't open $db: ".mysql_error() );
$Query = "select * from tblNews where extract(YEAR_MONTH from newsDate) = extract(YEAR_MONTH from CURRENT_DATE)";
$Query2 = "select * from tblNews Order By newsDate DESC";
$result = mysql_query($Query, $link);
$result2 = mysql_query($Query2, $link);
?>
How would I format the URL to retrieve $result if I only wanted the current months news items and vice versa?
The first link would only display the current months news items and the second would display all news items.
Here's my php code so far in index.php
<?php
$user = "username";
$pass = "pass";
$db = "database";
$link = mysql_connect ("localhost", "username", "pass"
if ( ! $link )
die( "Couldn't connect to the database" );
mysql_select_db ( $db )
or die( "Couldn't open $db: ".mysql_error() );
$Query = "select * from tblNews where extract(YEAR_MONTH from newsDate) = extract(YEAR_MONTH from CURRENT_DATE)";
$Query2 = "select * from tblNews Order By newsDate DESC";
$result = mysql_query($Query, $link);
$result2 = mysql_query($Query2, $link);
?>
How would I format the URL to retrieve $result if I only wanted the current months news items and vice versa?