I have an array that contains a list of database's and associated data. My Php script then checks the databases for various situations and then sends an email if that situation is found. At present it works simply with a variable (if problem found 'set $var=1', then at the end of the loop 'if $var==1' send email).
But as the script updates every 60 seconds I was looking to reduce it by using $POST to pass $var across. But, as there are multiple databases, I was looking to incorporate $var into the array (and later on find a way of $POST the array - but that's for later).
The problem I have at the minute, is how to update the array.
So far I have:
Code: Select all
$connections_array[] = array('server' => 'localhost:3306',
'user' => $u,
'password' => $p,
'database' => 'MySQL01',
'sendmail' => '0'
);
for($i = 0; $i <sizeof($connections_array); $i++) {
$connect to db etc. etc. etc.
while($row = mysql_fetch_assoc($result)) {
if ($row['Slave_IO_Running'] == "No")
{
$connections_array[$i]['sendmail'] = '1');
}
etc. etc. etc.
If ($connections_array[$i]['sendmail'] == 1)
send email etc. etc.
So I was wondering what is the correct sytax to use when updating an Array element?