I have problem with one query which get data from 2 tables:
SELECT C.*, US.*
FROM `".DB_TABLE_USERS."` US
LEFT JOIN ".DB_TABLE_AUTH." AS AU ON AU.auth_user_id=US.".DB_TABLE_USERS_ROW_ID."
LEFT JOIN ".DB_TABLE_CLINICS." C ON C.".DB_TABLE_CLINIC_ROW_ID." = US.".DB_TABLE_USERS_ROW_CLINIC."
WHERE AU.auth_code_id = '".$_SESSION[ AUTH_SESSION_AUTHID ]."'
Result is sth like this( I've removed some fields from here ):
Array
(
[clinic_id] => 1
[clinic_row1] => Row1
[clinic_row2] => Row2
[user_id] => 8
[user_username] => owner
)
But I would like to have sth like this:
Array
(
[user_id] => 8
[user_username] => owner
[clinic_data] => Array (
[clinic_id] => 1
[clinic_row1] => Row1
[clinic_row2] => Row2
)
)
Is it possible? I've tried
C.* AS clinic_data
But this doesn't work. Any one can help?