In diesem Code habe ich die vorbereitete Anweisungsabfrage verwendet, ich möchte die Anzahl der Zeilen, aber im folgenden Code gibt sie mir null Zeilen zurück. Bitte sagen Sie mir, was in meinem Code falsch ist.Der folgende Code gibt die Anzahl der Zeilen als Null zurück.
$servername = "localhost";
$username = "root";
$password = "";
$dbname="lamp";
$conn = new mysqli($servername,$username,$password,$dbname);
if ($conn->connect_error)
{
die("Connection failed: " . $conn->connect_error);
}
$contactno=mysqli_real_escape_string($conn,$_POST['contactno']);
$description=mysqli_real_escape_string($conn,$_POST['description']);
$email=mysqli_real_escape_string($conn,$_POST['contactemail']);
$subject=mysqli_real_escape_string($conn,$_POST['subject']);
$creationdate=mysqli_real_escape_string($conn,$_POST['creationdate']);
if(isset($_POST['status1']))
{
$status =$_POST['status1'];
}
if(isset($_POST['noteid']))
{
$id = mysqli_real_escape_string($conn,$_POST['noteid']);
}
$stmt=$conn->prepare("update notifications set subject=?,description=?
,status=?, creationdate=?,contactno=?,contactemail=? where id=? "); $stmt->bind_param("ssisisi",$subject,$description,$status,$creationdate,$contactno,$email,$id);
$stmt->execute();
$stmt->store_result();
if($stmt->num_rows >0)
{
echo "sucess";
header("Location: updategovermentnotification.php");
}
wie Try this: http://www.w3schools.com/php/php_mysql_update.asp Weil 'update' zurückkehren würde nicht' num_rows' –
Notwendigkeit 'zu verwenden, wenn (mysqli_affected_rows ($ conn)> 0) {' anstelle von 'if ($ stmt-> num_rows> 0) {', weil update basierend auf der erfolgreichen Ausführung nur wahr oder falsch zurückgibt –