Hi there,
I'm having a little trouble with using arrays :rolleyes:
Basically, I need to structure the array like the following but from a database.
$list = array(
'Node 1' => 'node1.thisurl.com',
'Node 2' => 'node2.thisurl.com'
);
The database I have is set out like this:
id | server | location | url | ftp | smtp | http | pop | mysql
I've got the data in the table already, but all i need to do now is generate the array.
I've tried this
$sql = "SELECT `server`, `url` FROM `table`";
$result = mysql_query($sql);
while ($row = mysql_fetch_array($result)){
$list = array(
$row['server'] => $row['url'],
);
}
But it doesnt seem to be working.. I've probably missed something really stupid, but hey, i'm a noob..
Any help would be REALLY appreciated 🙂
Dave