Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/288.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
PHP PDO-从查询中排除特定行_Php_Mysql_Pdo - Fatal编程技术网

PHP PDO-从查询中排除特定行

PHP PDO-从查询中排除特定行,php,mysql,pdo,Php,Mysql,Pdo,我正在使用PDO连接到我的数据库。我想执行一个查询并仅从查询中排除某一行。我不知道怎么做 根据我从另一个问题得到的建议,我发布了这是我目前的解决方案,但它不起作用 $queryProfileCode = $dbh->prepare("SELECT profile_code FROM tableBusinessProfiles WHERE profile_code = ? AND NOT EXISTS(SELECT * FROM tableBusinessProfiles WHERE pro

我正在使用PDO连接到我的数据库。我想执行一个查询并仅从查询中排除某一行。我不知道怎么做

根据我从另一个问题得到的建议,我发布了这是我目前的解决方案,但它不起作用

$queryProfileCode = $dbh->prepare("SELECT profile_code FROM tableBusinessProfiles WHERE profile_code = ? AND NOT EXISTS(SELECT * FROM tableBusinessProfiles WHERE profile_code = $businessProfileIDUrl)");
$queryProfileCode->bindValue(1,$profileCode);
$queryProfileCode->execute();
$resultTableProfileCode = $queryProfileCode->fetchAll();

我找不到如何从查询中排除特定记录。

我不确定您试图实现什么?问题是查询

如果配置文件代码不等于$businessProfileIDUrl,是否从tableBusinessProfiles获取所有配置文件代码

查询可以是:

SELECT profile_code FROM tableBusinessProfiles WHERE profile_code != $businessProfileIDUrl
您的查询应该是

SELECT 
profile_code 
FROM tableBusinessProfiles 
WHERE 
profile_code != $businessProfileIDUrl


MySQL“不等于”运算符是!=和**

需要排除哪些记录?它符合什么条件?
SELECT 
profile_code 
FROM tableBusinessProfiles 
WHERE 
id NOT IN ($businessProfileIDUrl);