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

  • Home
  • SEARCH
  • 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 8477487
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T18:28:52+00:00 2026-06-10T18:28:52+00:00

I’m developing a script for checking the state of different services on a hosting

  • 0

I’m developing a script for checking the state of different services on a hosting platform, which sends the state to a database (0 : Online / 1 : Disfunctional / 2 : Offline / 3 : Unknown) for each service.

I’m receiving the following error : Notice: Undefined index: in /home/cuonicco/public_html/olympe/inc/updatestatus.php on line 164

Here is the code, I have cut out some parts (the other 3 different verifications) :

<?php

ini_set('display_errors', 1);
error_reporting(E_ALL);

$info = array();
$data = array();

$mysqli = new mysqli("*********", "*********", "*********", "*********");

$query = $mysqli->prepare("SELECT name, status FROM olympe");
$query->bind_result($name, $status);
$query->execute();
$query->store_result();
$count = $query->num_rows;

if($count > 0)
{
    while($query->fetch())
    {
        $info[$name]['status'] = $status;
    }
}

$query->close();

// Verification Panel :

$panel = curl_init("https://hosting.olympe.in/login");
curl_setopt($panel, CURLOPT_TIMEOUT, 10);
curl_setopt($panel, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($panel, CURLOPT_HEADER, FALSE);
curl_setopt($panel, CURLOPT_RETURNTRANSFER, TRUE);

$result = curl_exec($panel);
$http_status = curl_getinfo($panel, CURLINFO_HTTP_CODE);
curl_close($panel);

if($http_status == 200)
{
    $data['panel']['status'] = 0;
}
elseif($http_status == 500)
{
    $data['panel']['status'] = 1;
}
else
{
    $data['panel']['status'] = 2;
}

// Verification HTTP :

$http = curl_init("http://cuonic.olympe.in/status/test-http.php");
curl_setopt($http, CURLOPT_TIMEOUT, 10);
curl_setopt($http, CURLOPT_HEADER, FALSE);
curl_setopt($http, CURLOPT_RETURNTRANSFER, TRUE);

$result = curl_exec($http);
$http_status = curl_getinfo($http, CURLINFO_HTTP_CODE);
curl_close($http);

if($http_status == 200)
{
    $data['http']['status'] = 0;
}
else
{
    $data['http']['status'] = 2;
}

// More verification functions...
// ....
// Database updating :

$array_count = count($data);
$i = 0;

while($i <= $array_count)
{
    $name = key($data);
    $array = current($data);

    if($info[$name]['status'] != $data[$name]['status']) // Error occurs here
    {
        $query = $mysqli->prepare("INSERT INTO log (name, previous, latest) VALUES (?, ?, ?)");
        $query->bind_param("sii", $name, $info[$name]['status'], $data[$name]['status']);
        $query->execute();
        $query->close();
    }

    $query = $mysqli->prepare("UPDATE olympe SET status = ? WHERE name = ?");
    $query->bind_param("is", $data[$name]['status'], $name);
    $query->execute();
    $query->close();

    next($data);
    $i++;
}

?>

What exactly is causing this, it’s been bugging me all day. I have echoed out the values of the arrays before the “error line” and they all exist.

Thanks in advance 🙂

  • 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-10T18:28:54+00:00Added an answer on June 10, 2026 at 6:28 pm

    Without knowing which line is throwing the error, I’m still 95% certain your problem is with while($i <= $array_count). When iterating over arrays, the rule of thumb to prevent yourself from going out of bounds is that you use strictly less-than < when indexing starts at 0, and use less-than-or-equal-to <= when indexing starts at 1. Try switching <= with < and see if that removes your error.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an autohotkey script which looks up a word in a bilingual dictionary
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I would like to run a str_replace or preg_replace which looks for certain words
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have a text area in my form which accepts all possible characters from
I'm trying to select an H1 element which is the second-child in its group
I have a view passing on information from a database: def serve_article(request, id): served_article

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.