簡體   English   中英

為什么這個md5函數有時返回null?

[英]Why is this md5 function returning null sometimes?

我從mysql數據庫中選擇了幾個值,將它們組合並哈希化。 有時結果為空。 有人知道為什么嗎?

首先,我們獲取代表該行的關聯數組。

$results = dal::query("select foo, email from wtf where email = ?", $_GET["email"], "row");

然后我們檢查真實結果和哈希值。

if($results["foo"] && $results["email"]){
   $whyisthisnullsometimes = md5($results["foo"] . $results["email"]);
   $url = "https://example.com/dostuff.php?thing={$whyisthisnullsometimes}";
}

$ whyisthisnull有時有時只是null。 不知道為什么。

該URL會附加到電子郵件中並發送。 用戶正在點擊此鏈接,如果($ results [“ foo”] && $ results [“ email”])計算為false,該鏈接將不存在。

wtf.foo是char 32,wtf.email是varchar250。排序規則是latin1_swedish_ci

那是快速答案:

什么時候

if($results["foo"] && $results["email"]){ 

你的條件是假的,你$whyisthisnullsometimes沒有定義$whyisthisnullsometimes而php將其解釋為null

有關更多信息,您應該發布更大的代碼片段:-)

暫無
暫無

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

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