Here's my code:
Mysql table:
group
| id | name | permission |
users
| id | name | username | group |
$sql = 'SELECT * FROM `users` u LEFT JOIN `groups` g ON g.id = u.group WHERE u.name = ? OR u.id = ?;
Since I have columns named the same, when I try to set the names in php, it is giving me wrong data (from groups to be exact)
'ID' => isset($user->data()->u.id) ? escape($user->data()->u.id) : NULL,
'NAME' => isset($user->data()->u.name) ? escape($user->data()->u.name) : NULL,
'USERNAME' => isset($user->data()->u.username) ? escape($user->data()->u.username) : NULL,
It is giving me error: Fatal error: Cannot use isset() on the result of an expression (you can use "null !== expression" instead) in C:\aaa\lang\en\common.lang.php on line 9
How can I write an SQL in a way where it doesn't interfier with my objects else where?
PS: I'm aware that I can rename my columns, but it will take me forever and I'm sure there's got to be a better way.
-Thanks