Я пытаюсь собрать SQL-запрос, и его все запутало, я выписал на нормальном языке то, что мне нужно, я не могу его получить.
select * from introles where introle = $key
then check the table 'availability' for the user_id taken from the introles table
then out of those results, check that $_POST['date'] is not equal to the date in the 'availability' table
Любая помощь будет потрясающей:)
EDIT: структура таблицы выглядит следующим образом
Табличные вставки имеют следующие
id
user_id
introle
Доступность таблицы имеет следующий
id
user_id
date
$query = "SELECT a.id AS aId, i.id AS iId, a.user_id, introle, date FROM availability AS a, introle AS i WHERE date != {$_POST['date']} AND a.user_id IN (SELECT user_id FROM introle WHERE introle = {$key})";
можете попробовать
'$variable'
вместо
$variable
для всех переменных в sql-запросе?