我的查询中有错误

拉姆吉

我对此有一个小问题:

public function is_present($Idarticle,$email){

$query=" SELECT * FROM envmail WHERE mail_env='$email' AND id_article='$Idarticle' ";

return mysql_query($query,$this->connection);

}

if($alert->is_present($idarticle,$email)){
echo "yes";
}
else echo "no";

mail_env是一个varchar,而id_article是一个int。我一直都是。

shyammakwana.me

将您的代码更改为此。

public function is_present($Idarticle,$email){

$query=" SELECT * FROM envmail WHERE mail_env='$email' AND id_article='$Idarticle' ";

$result = mysql_query($query,$this->connection);

//return mysql_num_rows($result);
// Update as suggested by @Mark
return mysql_num_rows($result) !== 0

}


//if($alert->is_present($idarticle,$email) > 0 ){
// Updated
if($alert->is_present($idarticle,$email)){
echo "yes";
}
else echo "no";

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

我正在尝试更新表SQL的值Java中有错误

当我有单逗号和|时,SQL语法中有错误。

SQLException SQL语法中有错误

如果我们在CloudFormation中有错误条件和Ref会发生什么?

查询在SQL Developer中有效,但在MyBatis中有错误

我在我的get方法中有错误,它向我显示404错误.net核心和角度

我的查询对吗?需要帮助...总是有错误

parseInt行中有错误

我的代码有错误

我在时区设置中有错误

mysql查询可以返回空或空集,其中有错误

我在joomla中有一个错误-请查询。我在这个查询中有错误

坚持修复此查询,我写的两个命令中有错误

我在R.java中有错误?

@Query,存储库中有错误

刽子手游戏在我的选择方法中有错误

我在 OpenCV 中有错误“approxPolyDP(ROI_Vertices, ROI_Poly, 1.0, true)”

我在应用程序主题的styles.xml 中有错误

我在 Verilog 上的定义中有错误 for

我现在没有,为什么我在这个 sql 请求中有错误

我在 mysql 函数中有错误?ERROR 不允许从函数返回结果集

pyspark agg 告诉我列名称中有错误的字符,但名称似乎正确

如何使用 case_when 而不是 if_else [我的代码中有错误?]

我有错误的 sql 查询

当我使用 ConcurrentMessageListenerContainer 时,如何跳过在 kafka 中有错误的味精?

discord.py 在我的不和谐机器人中有错误如何修复?

我需要 20 个在 pom.xml 中有错误的入门项目

我在服务器会话中有错误,无法解决

我的代码中有错误,当前错误是 TypeError: 'NoneType' object is not subscriptable