PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old October 10th, 2001, 09:24 AM
dennisk dennisk is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2001
Posts: 4 dennisk User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
listing last 15 days

Hello,

How can I make a navigation script to display the results of the last 15 days?
I use this for my first page:
PHP Code:
 $prev mktime (0,0,0,date("m"),date("d")-16,date("Y"));
$prev date("m.d.Y"$prev);

$today date("m.d.Y");

$sql "SELECT id,date,releasenr,title FROM gbadb WHERE date > ('$prev') AND date < ('$today') ORDER BY date DESC, releasenr DESC"

I want a script that create links like "index.php?page=2", so if you click on that link you will see the results between 15 days ago and 30 days ago.

Sorry for my english, I hope you guys know what I mean.

Thnx!

Reply With Quote
  #2  
Old October 10th, 2001, 09:50 AM
jdk's Avatar
jdk jdk is offline
phpkid ~~~~~~ :o)
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Nov 2000
Location: NJ, USA
Posts: 2,535 jdk User rank is Lance Corporal (50 - 100 Reputation Level)jdk User rank is Lance Corporal (50 - 100 Reputation Level)jdk User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 11 m 11 sec
Reputation Power: 11
Send a message via Yahoo to jdk
hi,
you can use mysql's date time function for getting appropriate results.

$sql = "SELECT id,date,releasenr,title FROM gbadb WHERE date > date_sub(date,interval 16 days ) ORDER BY date DESC, releasenr DESC";

and to get a navigation like what you want,

now i think you should get hind and should be able to code navigation like what you want.

jd
__________________
_____________________________
d.k.jariwala (JD)
~ simple thought, simple act ~
I blog @ http://jdk.phpkid.org

Reply With Quote
  #3  
Old October 10th, 2001, 11:45 AM
dennisk dennisk is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2001
Posts: 4 dennisk User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I have found another solution:
PHP Code:
 $limitonder = ($page 1) * 16;
$limitboven = ($page) * 16;

$prev mktime (0,0,0,date("m"),date("d")-$limitonder,date("Y"));
$prev date("m.d.Y"$prev);

$test mktime (0,0,0,date("m"),date("d")-$limitboven,date("Y"));
$test date("m.d.Y"$test);

if (
$page == '') {
header ("Location: test.php?page=1");
}

$vorige = ($page-1) ? "<A HREF=\"test.php?page=" . ($page 1) . "\">next 15 days</A>" "next 15 days";
$volgende = ($page+1) ? "<A HREF=\"test.php?page=" . ($page 1) . "\">previous 15 days</A>" "previous 15 days";

$navigation "[ $volgende | $vorige ]";

$sql "SELECT * FROM gbadb WHERE date < ('$prev') AND date > ('$test') ORDER BY date DESC, releasenr DESC"

Only one problem the navigation script is making a "previous 15 days" link on the last page, there should be no link...
someone can help?
And is there another way for this?
PHP Code:
if ($page == '') {
header ("Location: test.php?page=1");


This is not working:
PHP Code:
if ($page == '') {
$page="1";


Thnx

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPHP Development > listing last 15 days


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
Stay green...Green IT