Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7950671
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T02:20:44+00:00 2026-06-04T02:20:44+00:00

I try to make a diagram with RGraph(JS). I have a user counter on

  • 0

I try to make a diagram with RGraph(JS). I have a user counter on my site. And now I want to make a user-statistic with this diagram.

However I created a list which should be used for every query (made a form to choose month and year).

My problem is that the code doesnt enter the loop to create the new values (Day and Count).

Any idea?

Here the code:

$days = 0;
$day_value = array();

//check months which have 30 days
if (in_array($month, array(4,6,9,11))) {
    $days = 30; 

}
//leapyear?
if ($month == 2) {
    if ($year%4 == 0) {
        $days = 29;
    } else {
        $days = 28;
    }
} 

//Count users for each day
for ($i=1; $i<=$days; $i++) {
    $sql = "SELECT
                 Anzahl
            FROM
                 Counter
            WHERE
                 YEAR(Datum) = '".$year."' AND
                 MONTH(Datum) = '".$month."' AND
                 DAYOFMONTH(Datum) = '".$i."'";
    if (!$result = $db->query($sql)) {
        return $db->error;
    }

    $row = $result->fetch_assoc();
    $day_value[$i] = (int)$row['Anzahl'];
} 

//delete list for new month/year
$sql = "DELETE
        FROM
            Statistics
           ";
if (!$result = $db->query($sql)) {
    return $db->error;
}

//Create list with values for each day
for ($j=1; $j<=$days; $j++) {
    $sql = "INSERT INTO 
                Statistics(Day,Count)
            VALUES 
                (?, ?)";
    $stmt = $db->prepare($sql);
    if (!$stmt) {
        return $db->error;
    }
    $stmt->bind_param('ii', $j, $day_value[$j]);
    if (!$stmt->execute()) {
        return $stmt->error;
    }

    $stmt->close();
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T02:20:45+00:00Added an answer on June 4, 2026 at 2:20 am

    $days is set to 0, it only changes if $months is 2,4,6,9,11 so for every other value of $month $days will be 0 and not enter the for loop.

    if (in_array($month, array(4,6,9,11))) {
    //code
    }
    elseif ($month == 2) {
    //code
    }
    else{
    //code
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'll try make this short. I want to get a list of browsers installed
I try to make user registation form. I have two user types and want
Ill try and make this as clear as possible. I have a contact form
I try to make a simple counter. My counters do not go up however.
So, I have followed this instruction from ADO.NET team blog to try to make
I try to make a registration form. When user post the fields, i check
I try to make have an EventListener in ItemRenderer but its not working. How
I try to make a displaying list with onmouseover() with some links but they
I will try to make this as clear as I can, but if you
I am starting this question to try and make a central point developers can

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.