Here you can find plenty of help with your general coding needs and projects
If it is about a specific program, use the corresponding forum
DO NOT ask basic questions such as "How do I print a variable", use Google for that
by Ramsbams » Thu Nov 23, 2006 8:10 pm
I'm looking for a way to make the text in the "Last updated" column turn red if the character has not been updated for 14 days. We want our members to update on a regular basis and this would be a great way to expose the "sinners" :-p
Shouldn't that be possible?
some if-commands and stuff?
Any suggestions?
Last edited by
Ramsbams on Thu Nov 23, 2006 8:10 pm, edited 1 time in total.
-
Ramsbams
- WR.net Apprentice
-
- Posts: 10
- Joined: Tue Jul 18, 2006 6:00 pm
by Ramsbams » Thu Nov 23, 2006 8:21 pm
I just found:
- Code: Select all
function get_days($start, $stop) {
$minute = 60;
$hour = $minute * 60;
$day = $hour * 24;
$begin = strtotime($start);
$end = strtotime($stop);
$diff = floor(($end - $begin) / $day); if ($diff >= "0"){
$color = "green";
}
if ($diff >= "5"){
$color = "yellow";
}
if ($diff >= "15"){
$color = "red";
}
return "<font color=".$color.">".$diff;
}
$h = date("h");
$mi = date("i");
$s = date("s");
$y = date("y");
$m = date("m");
$d = date("d");
$a = date("a");
if ($a == "pm" && $h < "12"){
$h = ($h + 12);}
$time = "$m/$d/$y $h:$mi:$s";
echo $time;
$striping_counter++;
$verbindung=mysql_connect($db_host,$db_user,$db_passwd);
if (!$verbindung)
echo "unable to access the database at this time.";
mysql_select_db($db_name, $verbindung);
$ergebnis = mysql_query("SELECT * FROM `".ROSTER_PLAYERSTABLE."` ORDER BY name ASC LIMIT 0 , 300");
while($row = mysql_fetch_object($ergebnis))
{
$start = $row->dateupdatedutc;
$end = $time;
$striping_counter++;
$ergebnis2 = mysql_query("SELECT * FROM `".ROSTER_MEMBERSTABLE."` WHERE `member_id` = '".$row->member_id."' ORDER BY name ASC LIMIT 0 , 300");
$row2 = mysql_fetch_object($ergebnis2);
echo'
<tr>
<td class="membersRow'. (($striping_counter % 2) +1) .'"><font face="arial" size="2" color="#ffffff">'.$row->name.'</font></td>
<td class="membersRow'. (($striping_counter % 2) +1) .'"><font face="arial" size="2" color="#ffffff">'.$row->class.'</font></td>
<td class="membersRow'. (($striping_counter % 2) +1) .'"><font face="arial" size="2" color="#ffffff">'.$row->level.'</font></td>
<td class="membersRow'. (($striping_counter % 2) +1) .'"><font face="arial" size="2" color="#ffffff">'.$row2->guild_title.'</font></td>
<td class="membersRow'. (($striping_counter % 2) +1) .'"><font face="arial" size="2" color="#ffffff">'.get_days($start, $end).'</font></td>
</tr>
';
}
mysql_free_result($ergebnis);
mysql_close($verbindung);
somewhere else. It gives the following result:
http://magiknights.liquenox.net/toysold ... upload.php
Now all I / We need to do is integrate this to the main roster page (memberslist.php). Surely that is doable!?
-
Ramsbams
- WR.net Apprentice
-
- Posts: 10
- Joined: Tue Jul 18, 2006 6:00 pm
by reshurc » Mon Feb 26, 2007 2:46 pm
Does this still work? If so, what file is it?
-
reshurc
- WR.net Apprentice
-
- Posts: 10
- Joined: Fri Jan 12, 2007 9:19 am
-
Return to General Code Help
Who is online
Users browsing this forum: No registered users and 0 guests