adzie Posted September 16, 2007 Share Posted September 16, 2007 I have a script which gives me a report based on which member group I am in but I'd like it to report on all member groups. I have tried changing the session ID to no avail any suggestions? session_start(); if($_SESSION['online'] == 1) { if($_SESSION['oc'] == 1) { $sql = "select * from members where member_id=".$_SESSION[id]; $query = mysql_query($sql); $row3 = mysql_fetch_row($query); $sql = "select * from membergroups where ID=".$row3['4']; $query = mysql_query($sql); $row = mysql_fetch_row($query); $query_hours = "SELECT sec_to_time(sum(time_to_sec(t2.duration))) AS duration_sum FROM members t1, member_reports t2 WHERE t1.country=".$row3[4]." AND t1.member_num=t2.pnum"; $result_hours = mysql_query($query_hours); if (mysql_numrows($result_hours) > 0) { $time = mysql_result($result_hours,0,"duration_sum"); } $sql2="select * from members where country=\"".$row[0]."\""; $query2 = mysql_query($sql2); $members = mysql_numrows($query2); $avg = $time/$members; $avg = substr($avg,0, strpos($avg,".")+3); $sql2="select * from members where country=\"".$row[0]."\""; $query2 = mysql_query($sql2); $members = mysql_numrows($query2); $msg.= "<center><img src=images/avatars/".$row['3']."><br> <br> <br> <table border=4 align=center><tr><tr align=center><td><strong>Member Group</strong></td><td><strong>Members</strong></td><td><strong>Hours</strong></td><td><strong>Average Hours Per Member</strong></td></tr> <tr align=center><td>".$row['1']."</td><td>".$members."</td><td>".$time."</td><td>".$avg."</td></tr> </table> Quote Link to comment https://forums.phpfreaks.com/topic/69562-reporting-expansion/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.