PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
DynamiteHost
Forum Commoner
Posts: 69 Joined: Sat Aug 10, 2002 5:33 pm
Post
by DynamiteHost » Sun Sep 15, 2002 7:51 am
You people have been great over the last couple of days (especially hob_goblin). Now I need some more code
Code: Select all
if (between $today-7 and $today) {
stuff here
}
else {
nothing
}
Problem is, It would have to read from a mysql table instead of doing the IF.... I think
Hope you aren't confused like me
DynamiteHost
Forum Commoner
Posts: 69 Joined: Sat Aug 10, 2002 5:33 pm
Post
by DynamiteHost » Sun Sep 15, 2002 7:58 am
I've just been thinking and I may have come up with a solution to my problem
Just wondering is this the best way and would it work?
Code: Select all
mysql_query = select * from table etc
if ($tableinfo >= $today-7 && $tableinfo <= $today) {
stuff here
}
else {
other stuff
}
Takuma
Forum Regular
Posts: 931 Joined: Sun Aug 04, 2002 10:24 am
Location: UK
Contact:
Post
by Takuma » Mon Sep 16, 2002 5:20 pm
Yes it would and that's probably the only code you could use
phice
Moderator
Posts: 1416 Joined: Sat Apr 20, 2002 3:14 pm
Location: Dallas, TX
Contact:
Post
by phice » Mon Sep 16, 2002 5:23 pm
DynamiteHost wrote: I've just been thinking and I may have come up with a solution to my problem
Just wondering is this the best way and would it work?
Code: Select all
mysql_query = select * from table etc
if ($tableinfo >= $today-7 && $tableinfo <= $today) {
stuff here
}
else {
other stuff
}
Code: Select all
mysql_query = select * from table etc
if (($tableinfo >= $today-7) && ($tableinfo <= $today)) {
stuff here
}
else {
other stuff
}
Last edited by
phice on Tue Sep 17, 2002 11:23 am, edited 1 time in total.
hob_goblin
Forum Regular
Posts: 978 Joined: Sun Apr 28, 2002 9:53 pm
Contact:
Post
by hob_goblin » Mon Sep 16, 2002 6:54 pm
Code: Select all
$qry = mysql_query("select * from table")
$data = mysql_fetch_assoc($qry);
$tableinfo = $dataї'day']; // or whatever the column is named
$today = date("d");
if(($today-7) < 0){
$week = 0;
} else {
$week = $today-7;
}
if (($tableinfo >= $week) && ($tableinfo <= $today)) {
//stuff
}
else {
//other stuff
}
you know, something like that.
jason
Site Admin
Posts: 1767 Joined: Thu Apr 18, 2002 3:14 pm
Location: Montreal, CA
Contact:
Post
by jason » Mon Sep 16, 2002 7:03 pm
DynamiteHost: What are you trying to do exactly?