Hey,
Thanks Anthony, i have done the admin section as i thought i could get it out of the way. I am basically inserting fitness courses which have a specific date. Now the date is inserted into the database, which now works fine.
If you look at this page: http://www.glofamily.com/glo/fitness-courses/
You will see it says wc June 2010
Now i need this to say wc May 31st 2010
I have the following code in my page:#
PHP Code:
<?php
$courses = Course::selectByCurrentWeek('fitness');
if(isset($_GET['week'])){
$addweek = $_GET['week'];
}
else{
$addweek = 0;
}
$nextweek = 7 + $addweek;
$prevweek = -7 + $addweek;
$week = mysql_fetch_array(Course::getWeek());
$week = $week['week'];
$week = strtotime($week);
$week = date("F Y",$week);
?>
And i use the following methods, i have put these together but am aware that these might be totally the wrong way of doing it..
PHP Code:
<?php
class Course{
public function selectByCurrentWeek($catID){
if(isset($_GET['week'])){
$week = $_GET['week'];
}else{
$week = 0;
}
$sql = "SELECT *
FROM tbl_courses e
WHERE WEEK(date) = WEEK(CURRENT_DATE) + $week
AND catID = '$catID'
AND deleted = 0
ORDER BY date ASC";
$result = mysql_query($sql);
return $result;
}
public function getWeek(){
if(isset($_GET['week'])){
$week = $_GET['week'];
}else{
$week = 0;
}
$sql = "SELECT DATE_ADD(CURRENT_DATE, INTERVAL $week WEEK) as week
FROM tbl_courses e";
$result = mysql_query($sql);
return $result;
}
}
Can you see what i am doing wrong?
I need to display the week commencing date as shown above..
Any ideas?
Thanks
Bookmarks