Page 1 of 1

Help plz (again)!

Posted: Sun Sep 15, 2002 7:51 am
by DynamiteHost
You people have been great over the last couple of days (especially hob_goblin). Now I need some more code :D

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 8O


Hope you aren't confused like me :lol:

Posted: Sun Sep 15, 2002 7:58 am
by DynamiteHost
I've just been thinking and I may have come up with a solution to my problem :lol:

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) &#123;
stuff here
&#125;
else &#123;
other stuff
&#125;

Posted: Mon Sep 16, 2002 5:20 pm
by Takuma
Yes it would and that's probably the only code you could use

Posted: Mon Sep 16, 2002 5:23 pm
by phice
DynamiteHost wrote:I've just been thinking and I may have come up with a solution to my problem :lol:

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) &#123;
stuff here
&#125;
else &#123;
other stuff
&#125;

Code: Select all

mysql_query = select * from table etc 

if (($tableinfo >= $today-7) && ($tableinfo <= $today)) &#123; 
stuff here 
&#125; 
else &#123; 
other stuff 
&#125;

Posted: Mon Sep 16, 2002 6:54 pm
by hob_goblin

Code: Select all

$qry = mysql_query("select * from table")
$data = mysql_fetch_assoc($qry);
$tableinfo = $data&#1111;'day']; // or whatever the column is named
$today = date("d");
if(($today-7) < 0)&#123;
$week = 0;
&#125; else &#123;
$week = $today-7;
&#125;

if (($tableinfo >= $week) && ($tableinfo <= $today)) &#123; 
//stuff
&#125; 
else &#123; 
//other stuff 
&#125;
you know, something like that.

Posted: Mon Sep 16, 2002 7:03 pm
by jason
DynamiteHost: What are you trying to do exactly?