我正在检查以确认memberid和recipeid都不为空。这样,如果两者都具有价值,它将允许成员将成熟的广告添加到列表中,如果两者都有值,则会告诉他们他们添加的配方已经在列表中。在此工作一段时间需要帮助,并尝试从asp经典转换到php闪烁的微笑。需要查找两条记录中的一条是否为空
$check_fav = mysql_query("SELECT memberid, recipeid FROM favorites WHERE (memberid = '".$memberid."' AND recipeid = '".$id."')");
If ($check_fav == TRUE){.......
[您的脚本存在SQL注入攻击风险。](http://stackoverflow.com/questions/60174/how-can-i-prevent-sql-injection-in-php) –
请[停止使用' mysql_ *'functions](http://stackoverflow.com/questions/12859942/why-shouldnt-i-use-mysql-functions-in-php)。 [这些扩展](http://php.net/manual/en/migration70.removed-exts-sapis.php)已在PHP 7中删除。了解[编写](http://en.wikipedia.org/ wiki/Prepared_statement)语句[PDO](http://php.net/manual/en/pdo.prepared-statements.php)和[MySQLi](http://php.net/manual/en/mysqli.quickstart .prepared-statements.php)并考虑使用PDO,[这真的很简单](http://jayblanchard.net/demystifying_php_pdo.html)。 –
喜欢“微笑的笑容”。 –