Member_2_5230414
asked on
Change month name to number --- June to 6
Hey guys,
the script below shows:
2009
JUNE
2010
JUNE
AUGUST
How can i get this link:
echo "<a href='?year={$row['year']} &month={$r ow['month' ]}'>{$row[ 'month']}< /a><br />"; // in case you wanted links
to go from:
http://www.runningprofiles.com/members/test.php?year=2010&month=AUGUST
to
http://www.runningprofiles.com/members/test.php?year=2010&month=8
the script below shows:
2009
JUNE
2010
JUNE
AUGUST
How can i get this link:
echo "<a href='?year={$row['year']}
to go from:
http://www.runningprofiles.com/members/test.php?year=2010&month=AUGUST
to
http://www.runningprofiles.com/members/test.php?year=2010&month=8
$start = '2010-01-01'; // start of data to look at
$end = '2010-12-30'; // end of data to look at
$query = "SELECT DISTINCT YEAR(ev_dat) as year, UPPER(MONTHNAME(ev_dat)) as month FROM diary WHERE ev_dat ORDER BY ev_dat";
$result = mysql_query($query) or die("Query failed: $query<br />Mysql error: " . mysql_error());
$current_year = '';
while($row = mysql_fetch_assoc($result)){
// test for a change in the year
if($current_year != $row['year']){
echo $row['year'] . '<br />';
$current_year = $row['year']; // remember the new year
}
echo "<a href='?year={$row['year']}&month={$row['month']}'>{$row['month']}</a><br />"; // in case you wanted links
//echo "{$row['month']}<br />";
}
or in query use
$query = "SELECT DISTINCT YEAR(ev_dat) as year, Month(ev_dat) as month FROM diary WHERE ev_dat ORDER BY ev_dat";
and in link use
echo "<a href='?year={$row['year']} &month={$r ow['month' ]}'>{UPPER ($row['mon th'])}</a> <br />"; // in case you wanted links
$query = "SELECT DISTINCT YEAR(ev_dat) as year, Month(ev_dat) as month FROM diary WHERE ev_dat ORDER BY ev_dat";
and in link use
echo "<a href='?year={$row['year']}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
echo "<a href='?year={$row['year']} &month={da te("m", strtotime("$row['month'];" ))}'>{$row ['month']} </a><br />";
like that?
like that?
ASKER
$dd = date("m", strtotime($row['month']));
echo "{$row['month']}"; // in case you wanted links
work a treat thanks :P
echo "{$row['month']}"; // in case you wanted links
work a treat thanks :P
try
{month($row['month'])}