Code: Select all
$db1_array[] = array('server' => '172.x.x.x:3306',
'user' => $u,
'password' => $p,
'database' => 'Master',
'sendmail' => '0',
'repeat' => '0',
'dbID' => '01'
);
Code: Select all
$master_array = array_merge ( (array)$db1_array,
(array)$db2_array,
(array)$db3_array
);
But then I got stuck.
So far I have created a page that contains a form, that lists all the databases, with a tick box underneath.
Code: Select all
<form name="ConfigDBList" id="DBList" action="configChange.php" method="Post" >
<?php
include ('connections_array.php');
print "SLAVE DATABASES (for check slave status queries)";
print "<table style=\"width:98%\">";
print "<tr>";
foreach($connections_array as $db) {
$dbname = $db['database'];
$dbid = $db['dbID'];
print "<td>$dbname</td>";
};
print "</tr><tr>";
foreach($connections_array as $db) {
$dbname = $db['database'];
$dbid = $db['dbID'];
print "<td><INPUT TYPE=\"checkbox\" NAME=\"$dbid\" VALUE=\"$dbname\"></td>" ;
};
print "</tr>";
print "</table>";
print "</br>";
//REPEAT THIS 4 TIMES FOR THE 4 GROUPS I NEED
?>
<p class="submit"><input type="submit"/></p>
</form>
But this is where I run into problems, as I can't see a way to loop the incoming POST statement correctly, avoiding the need to write 80 POST statements on the receiving page (currently 20 databases listed x 4 groups).
Plus the dbID would be used 4 times, so I don't think I could actually refer to it anyway? Making it unique in the form (e.g. "sl_$dbID" = sl_01) would prevent me using to refer back to the original Array.
Any help / thoughts would be greatly appreciated.