如何檢查表是否包含特定行?我有一個表安排如下:檢查MySql表的行
Follower | Following | Time
[email protected] | [email protected] | 2014-02-07 19:05:58
[email protected] | [email protected] | 2014-03-12 09:03:12
說我是史蒂夫,我想「添加」按鈕,文本到現在顯示「刪除」。爲了做到這一點,它必須檢查表格,看看一行是否同時包含「[email protected]」和「[email protected]」。我怎麼做?先謝謝你。
更新1: 我試過如下:
$scan = $results[$counter];
$follow_email = mysql_query("SELECT email FROM members WHERE name = '$scan'");
$result = mysql_query("SELECT COUNT(*) cnt FROM follow WHERE follower = '$searcher_email' AND following = '$follow_email'");
if ($row['cnt'] == 0) {
$text212 = "Add";
}
if ($row['cnt'] == 1) {
$text212 = "Remove";
}
使用'WHERE'條款。 I.e:'Where Follower ='[email protected]'以下='jane @ gmail.com'' –
是的,我明白了。我正在測試它。 @ Fred-ii- – Lite20
好的。設置查詢後,如何評估結果以查看該行是否存在? @ Fred-ii- – Lite20