Jump to content

Warning: reset() expects parameter 1 to be array, null given H


coolapps

Recommended Posts

**MY ERRORS:**

 

Warning: reset() expects parameter 1 to be array, null given in /srv/disk10/1498077/www/stats.php on line 54

Warning: Variable passed to each() is not an array or object in /srv/disk10/1498077/www/stats.php on line 55

MY PHPFILE:

<?php
session_start();
session_register("sess_name");
session_register("sess_passwd");
session_register("sess_data");
include("vars.php");
include("headfoot.php");
mysql_connect($db_host, $db_user, $db_pwd);
mysql_select_db($db_name);
uheader();
?>

<h4>Member Surfing Statistics</h4>
<p>Below you will see the last 7 days of member credits earned, as well as, members websites shown. These statistics are automatically updated each time this page loads.</p>

<?php 
    $res = mysql_query("select distinct(date) from 7stat order by date desc limit 7");
    if(mysql_num_rows($res)>0){
    	while ($r= mysql_fetch_row($res)) {
    		$arr1u[]= $r[0];
    	}
    }

    $arr2 = array();
    while (list($k, $v) = each($arr1u)) {
        $res = mysql_query("select sum(num) from 7stat where date='$v'");
        $arr2[$v] = mysql_result($res, 0);
    }
    reset($arr2);
    while (list($k, $v) = each($arr2)) {
        $maxnum = $maxnum + $v;
    }
    $maxnum = round($maxnum);
echo("<p><div style=\"padding-left: 10px\"><hr><br></div></p>");
    echo("<p align=left><b>Credits Earned Last 7 Days:</b>
<table width=100% style=\"padding-left: 10px;\">");
    reset($arr2);
    while (list($k, $v) = each($arr2)) {
        $v = round($v);
        $px = 500 * ((($v * 100) / $maxnum) / 100);
        $px = round($px);
        echo("<tr><td width=10%><b>$k:</b></td><td align=left>$v Credits Earned</td></tr>");
    }
    echo("<tr align=center><td colspan=2><font color=#0000ff><b>7 Day Earned Total:</font><br>$maxnum Credits Earned</b></td></tr></table></p>");
echo("<p><div style=\"padding-left: 10px\"><hr><br></div></p>");
    $res = mysql_query("select distinct(date) from 7statsite order by date desc limit 7");
    $sarr1 = array();
    if(mysql_num_rows($res)>0){
    	while ($r = mysql_fetch_row($res)) {
    		$sarr1u[] = $r[0];
    	}
    }
    $sarr2 = array();
    reset($sarr1u);
    while (list($k, $v) = each($sarr1u)) {
        $res = mysql_query("select sum(num) from 7statsite where date='$v'");
        $sarr2[$v] = mysql_result($res, 0);
    }
    $maxnum = 0;
    reset($sarr2);
    while (list($k, $v) = each($sarr2)) {
        $maxnum = $maxnum + $v;
    }
    $maxnum = round($maxnum);
    echo("<p align=left><b>Websites Shown Last 7 Days:</b>
<table width=100% style=\"padding-left: 10px;\">");
    reset($sarr2);
    while (list($k, $v) = each($sarr2)) {
        $v = round($v);
        $px = 500 * ((($v * 100) / $maxnum) / 100);
        $px = round($px);
        echo("<tr><td width=10%><b>$k:</b></td><td align=left>$v Websites Shown</td></tr>");
    }
    echo("<tr align=center><td colspan=2><font color=#0000ff><b>7 Day Shown Total:</font><br>$maxnum Websites Shown</b></td></tr></table></p>");
?>

<?php
ufooter();
mysql_close;
exit;
?>

Please Help me!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.