I have problems with subquerys. In phpMyAdmin when I enter this:
SELECT companys.id
FROM companys
JOIN users
ON users.company = companys.id
WHERE users.id = '$LOGGED_IN_USER'
I get number 1 returned. That is correct.
And then I tested:
UPDATE companys
SET companys.signature = '$SIGNATURE'
WHERE companys.id = 1
That also works, it updates the value with $SIGNATURE where companys.id = 1. So far so good. Now to the problem. The problem appears when I combine those two:
UPDATE companys
SET companys.signature = '$SIGNATURE'
WHERE companys.id = ( SELECT companys.id
FROM companys
JOIN users
ON users.company = companys.id
WHERE users.id = '$LOGGED_IN_USER')
The DB never gets updated. It is like the inner select doesn't work suddenly for some reason.