Im trying to put together a SQL query and its g开发者_高级运维ot me all confused, i have written out in normal language what i need, i cant seem to get it.
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
Any help would be amazing :)
EDIT: The table structure is as follows
Table introles has the following
id
user_id
introle
Table availability has the following
id
user_id
date
can you try
'$variable'
instead of
$variable
for all variables in sql query?
$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})";
精彩评论