Thanks - I have changed
$query = "SELECT Path FROM tblCo";
$result = mysql_query($query);
$row = mysql_fetch_array($result);
$Path = $row["Path"];
to the following to force an array output
$query = "SELECT Path FROM tblCo";
$result = mysql_query($query);
while($row = mysql_fetch_array($result))
$Path[] = $row["Path"];
now I have more than one variable for the foreach ....
however now moved on to a databse connection issue.
after making this change I got the following error message Warning: main($value): failed to open stream: No such file or directory in /home/aaa/bbb/htdocs/ccc/ddd/code.php on line 24 so it is looking for the new database mysql_connect file in the exisiting location - this is never going to happen
so I have added an exit(); as the first line in the foreach clause, to exit the current master database before looking for the new connection information.
Now I get nothing happening - no error message - and the code doesn't input the information as required...........
The code I have now is
//connect to master database
require_once('/home/aaa/bbb/htdocs/ccc/ddd/mysql_connect.php');
// get all of the paths
$query = "SELECT Path FROM tblCo";
$result = mysql_query($query);
while ($row = mysql_fetch_array($result))
$Path[] = $row["Path"];
foreach ($Path as $value)
{
exit();
// connect to the new database
require('$value');
//run the code to insert data.......
} // foreach
} //close if
any ideas anyone? - thanks