k0r54
05-12-2005, 02:54 AM
Hi,
In my database I have a field called time stamp and in that is unix time stamp of when the last time some1 clicked on my site was.
Now if the click was within the last half hour say (CC_COUNTER_HIGHLIGHT_TIME ) then table that list the click, that row will apear red. That all works fine!
By using this code: -
if ((CC_COUNTER_HIGHLIGHT == true) && ((time() - $sql_row["tstamp"]) <= (CC_COUNTER_HIGHLIGHT_TIME * 3600))) {
$string .= " <tr class='highlighttblcolour'>\n";
} else {
$string .= " <tr>\n";
}
The problem i am having is that before i do the while blah blah to create the table I want to find out if there is any that will show up red.
The problem I am having is i dont know how to check through all the results to see if there is any under the half hour. I have this so far: -
if ((CC_COUNTER_HIGHLIGHT == true) && ((time() - ?????? <= (CC_COUNTER_HIGHLIGHT_TIME * 3600))) {
$string .= " <span class='spanhighlighted'>Hits within the last <strong>" . CC_COUNTER_HIGHLIGHT_TIME . "</strong> hour";
if (CC_COUNTER_HIGHLIGHT_TIME > 1) {
$string .= "s";
}
$string .= " are <span class='highlighttxtcolour'>highlighted</span>.</span>\n\n";
}
Where the ????? marks are i tried to use mysql_result($sql_res) but that didn't work? I think because it can only work if there is on row, But there may be more.
Thanks
Adam
In my database I have a field called time stamp and in that is unix time stamp of when the last time some1 clicked on my site was.
Now if the click was within the last half hour say (CC_COUNTER_HIGHLIGHT_TIME ) then table that list the click, that row will apear red. That all works fine!
By using this code: -
if ((CC_COUNTER_HIGHLIGHT == true) && ((time() - $sql_row["tstamp"]) <= (CC_COUNTER_HIGHLIGHT_TIME * 3600))) {
$string .= " <tr class='highlighttblcolour'>\n";
} else {
$string .= " <tr>\n";
}
The problem i am having is that before i do the while blah blah to create the table I want to find out if there is any that will show up red.
The problem I am having is i dont know how to check through all the results to see if there is any under the half hour. I have this so far: -
if ((CC_COUNTER_HIGHLIGHT == true) && ((time() - ?????? <= (CC_COUNTER_HIGHLIGHT_TIME * 3600))) {
$string .= " <span class='spanhighlighted'>Hits within the last <strong>" . CC_COUNTER_HIGHLIGHT_TIME . "</strong> hour";
if (CC_COUNTER_HIGHLIGHT_TIME > 1) {
$string .= "s";
}
$string .= " are <span class='highlighttxtcolour'>highlighted</span>.</span>\n\n";
}
Where the ????? marks are i tried to use mysql_result($sql_res) but that didn't work? I think because it can only work if there is on row, But there may be more.
Thanks
Adam