February 12, 200917 yr Yea... soo.. basically i need help with putting together a search on the front a website im designing to display pics of the date they search. i have a form on the front page, they select the day, the month and year.... when they click submit im looking to display all pics taken on that date. or even just display the archives taken on that date, so they can look into each archive. im thinking im going to have to submit each picture into my mysql database with that date on it? Or create a .php file with that date (e.g 12022009.php) then that page will have the pictures on, so that when they search the date, it changes the URL to http://www.site.com/12022009.php, or http://www.site.com/archive.php?date=12022009 i hope ive explained this well enough - any help on how i do this would be appretiated
February 12, 200917 yr Yea... soo.. basically i need help with putting together a search on the front a website im designing to display pics of the date they search. i have a form on the front page, they select the day, the month and year.... when they click submit im looking to display all pics taken on that date. or even just display the archives taken on that date, so they can look into each archive. im thinking im going to have to submit each picture into my mysql database with that date on it? Or create a .php file with that date (e.g 12022009.php) then that page will have the pictures on, so that when they search the date, it changes the URL to http://www.site.com/12022009.php, or http://www.site.com/archive.php?date=12022009 i hope ive explained this well enough - any help on how i do this would be appretiated Add each image to the database with the date in unix time format... Then do something like below: //users search $date=$_GET['date']; $date_day = date('d', $date); // Seperate the day into a variable $date_month = date('m', $date); // Seperate the month into a variable $date_year = date('Y', $date); // Seperate the year into a variable $query="SELECT date, filename FROM images ". "ORDER BY date ASC"; $result=mysql_query($query); $num=mysql_num_rows($result); if ($num != '0') { while ($row = mysql_fetch_assoc($result)) { $image_date_day = date('d', $row['date']); // Seperate the day into a variable $image_date_month = date('m', $row['date']); // Seperate the month into a variable $image_date_year = date('Y', $row['date']); // Seperate the year into a variable if ($date_year == $image_date_year) { if ($date_month == $image_date_month) { if ($date_day == $image_date_day) { //OUTPUT IMAGE HERE //OR //PUT IMAGE INTO AN ARRAY AND OUTPUT TOGETHER LATER } } } } } I hope that helps....
Create an account or sign in to comment