I have a select statement for example:
SELECT table1.id, name, table2.id, branch
FROM table1
INNER JOIN table2
ON userid = table2.id
WHERE table1.id = 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'] = table2.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:
Array
(
[0] => table1.id
[id] => table2.id
[1] => name
[name] => name
[2] => table2.id
[3] => branch
[branch] => branch
)