Select multiple fields with same name - array problem

I have a select statement for example:

SELECT, name,, branch
FROM table1
ON userid =
WHERE = 30;

So, this is just an example. The problem I’m having is now doing this:

$row = mysql_fetch_array($result)

Since there are two IDs being selected, my array looks like this:

$row['id'] =
$row['name'] = name
$row['branch'] = branch

There isn’t a second id item in the array and instead the first is being overwritten by the second value.

What am I doing wrong?

Edit: Actually the array looks more like this:

    [0] =>
    [id] =>
    [1] => name
    [name] => name
    [2] =>
    [3] => branch
    [branch] => branch

The best way is to use an alias

table_name.field_name AS alias_name

To get more then one record from a result set you need to use a loop.

while($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
    $the_result_set[] = $row;

Right on, that fixed it, thanks.

Also, I didn’t use a loop just because the select statement is only selecting one row.