繁体   English   中英

PHP / MySQL-构造查询

[英]PHP / MySQL - Constructing a Query

我试图把一个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

任何帮助都将是惊人的:)

编辑:表结构如下

表提示具有以下内容

id
user_id
introle

表的可用性如下

id
user_id
date

你能试一下吗

'$variable'

代替

 $variable

在SQL查询中的所有变量?

$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})";

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM