Hi, guys
Maybe someone on these forums can help me figure this out, ive been at it for 5 the solution is still eluding me.
I have a mysql table which looks like this
id gametype ip port
1 cssource 172.16.16.132 27015
2 cssource 172.16.16.131 27015
I am trying to pull the rows from mysql into an array with the following format
Array ( [1] => Array ( [0] => cssource [1] => 172.16.16.131 [2] => 27015 ) )
row_id^
I know how to do this with php, but getting it from mysql is the problem.
$arr = array('0' => array('cssource', '172.16.16.131', 27015),);
This is the code as have so far but for some reason it only fetches the last row on the table
$query="select * from 'gameservers' where gametype='cssource' order by 'id'";
$result = mysql_query($query) or die(mysql_error());
$num = mysql_num_rows($result);
echo "<br>";
echo "Servers:". $num ."";
echo "<br>";
while($row = mysql_fetch_array($result))
{
$servers = array($row['id'] => array($row['gametype'], $row['ip'],$row['port']),
);
}
print_r($servers);
Help would be appreciated thanks in advance.