簡體   English   中英

MySQL查詢不返回行,也沒有錯誤,其中phpMyAdmin在同一查詢中返回1行

[英]MySQL Query returns no rows and no errors where phpMyAdmin returns 1 row in the same query

我對這里發生的事情完全不了解。

這是我的代碼:

    $sid = "123";
    $sid_query_conf = mysql_query("SELECT email FROM users WHERE sid='$sid'");
if(!$sid_query_conf)
    die(mysql_error());

$result = mysql_fetch_assoc($sid_query_conf);

if(mysql_num_rows($result) == 0)
    die("Error processing your details");

它始終返回“錯誤處理您的詳細信息”,在哪里phpMyAdmin我得到了我想要的結果。 在此之前甚至有1個查詢,因此我知道它在此方面起作用。

我什至嘗試僅從表中選擇所有內容,但仍然不返回任何行。 mysql_fetch_result也什么也沒做。

我真的可以為使它無法正常工作提供一些幫助。

我相信mysql_num_rows($result)應該是mysql_num_rows($sid_query_conf)

另外,您不應該再使用mysql_ *函數,因為它們已被棄用,請改用PDO或mysqli。

http://php.net/manual/zh/function.mysql-num-rows.php

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM