Rekor php başarıyla güncellendi bilmek nasıl

1 Cevap php

$sql = "UPDATE....";

if(mysql_query($sql))
    {
        $_SESSION['Trans']="COMMIT";
        header("location:result.php");
        exit;
    }
    else 
        {
            $_SESSION['Trans']="FAIL";
            $_SESSION['errors'] = "Error: Sorry! We are unable to update your Profile, Please contact to PNP HelpDesk.";
            header("location:result.php");
            exit;
        }//end  IF

data is getting updated then why compiler is not coming inside IF condition.

1 Cevap

mysql_query yalnızca yerine hiçbir satır güncelleştirilmiş olup olmadığını daha, bir hata durumunda FALSE döndürür.

Şey güncellenmiş olup olmadığını, kullanmak görmek için mysql_affected_rows , örneğin:

$sql = 'UPDATE ....';
mysql_query($sql);
if (mysql_affected_rows() > 0) { 
  // Success
} else {
  // Failure
}