mysql_fetch_array is a built in function to php. However, if you’ve switched your Observium to using mysqli instead of the deprecated mysql library, you’ll probably want mysqli_fetch_array

 

From: observium [mailto:observium-bounces@observium.org] On Behalf Of Robert Williams
Sent: 05 July 2015 13:51
To: Observium Network Observation System (observium@observium.org)
Subject: [Observium] mysql_fetch_array replacement?

 

Hi,

 

After the SVN up on the 18th July the script we use for generating the Smokeping targets stopped producing any data (the list of slightly reformatted hostnames). The script itself was taken from this mailing list about 2 years ago and is as follows:

 

#!/usr/bin/env php

<?php

 

include("/opt/observium/includes/defaults.inc.php");

include("/opt/observium/config.php");

include("/opt/observium/includes/definitions.inc.php");

include("/opt/observium/includes/functions.php");

 

echo "*** Targets ***\n\nprobe = FPing\n\nmenu = Top\ntitle = Network Latency Grapher\nremark = Welcome to SmokePing\n\n";

 

$query = mysql_query("SELECT hostname FROM `devices` WHERE `disabled`=0 ORDER BY hostname");

 

while ($data = mysql_fetch_array($query)) {

  $hostid = str_replace(".","_",$data['hostname']);

  $hostname = $data['hostname'];

  echo "+ $hostid\n\nhost = $hostname\n\n";

}

 

?>

 

I can see that /includes/functions.php no longer exists but it’s replacement in functions.inc.php does not appear to have a function for mysql_fetch_array().

 

So my question is, can someone point me to the correct replacement function for this? I’ve had a look through it and can’t see what I’m looking for, but PHP is not my ‘thing’ so I’m missing it.

 

Any assistance appreciated!

Robert Williams
Custodian Data Centre
Email: Robert@CustodianDC.com
http://www.CustodianDC.com