PHP & SQL-Query is not being read

0

I have the following code, something is happening but I can not figure out why. ie the query is not being read, the echo appears to say "error"

<?php
        $_SESSION['message'] ='';
        include("config.php");

    if($_SERVER['REQUEST_METHOD'] == 'POST') {

         if(isset($_POST["send"])){

            $ISBN =$conn->real_escape_string($_POST['ISBN']);
            $Authorsname=$conn ->real_escape_string($_POST['Authorsname']);
            $Title= $conn ->real_escape_string($_POST['Title']);
            $edition= $conn ->real_escape_string($_POST['edition']);
            $year= $conn->real_escape_string($_POST['year']);
            $publisher= $conn->real_escape_string($_POST['publisher']);
            $category=$conn->real_escape_string($_POST['category']);
            $quantityinstock=$conn->real_escape_string($_POST['quantityinstock']);
            $price= $conn->real_escape_string($_POST['price']);


         }
               $stmt = $conn->prepare("UPDATE books SET Authorsname =?, Title=?, edition=?, year=?, category=?, publisher=?, quantityinstock=?, price=? WHERE ISBN=?");
               $stmt->bind_param("sssiissii",$ISBN,$Authorsname,$Title,$edition,$year,$publisher,$category,$quantityinstock,$price);
               $ISBN = $_POST['ISBN'];
               $Authorsname = $_POST['Authorsname'];
               $Title = $_POST['Title'];
               $edition = intval($_POST['edition']);
               $year = intval($_POST['year']);
               $publisher = $_POST['publisher'];
               $category = $_POST['category'];
               $quantityinstock = intval($_POST['quantityinstock']);
               $price = intval($_POST['price']);
               $stmt->execute();
               $stmt->store_result();


         if($stmt->affected_rows > 0)
         {
            $message = "You have succefully updated";
                    echo "<script>alert('$message'); window.location.href='update.php';</script>";


            }
                else
                {
                    echo 'Error';

                }
            }

    ?>
    
asked by anonymous 28.05.2017 / 23:29

1 answer

0

Has inversion

$stmt = $conn->prepare( ....... , category=?, publisher=?,  
$stmt->bind_param( ...............$publisher,$category,

and Missing after% with% of the column name to be updated with the value corresponding to $ ISBN variable

$stmt = $conn->prepare("UPDATE books SET ISBN =?, Authorsname =?,

$stmt->bind_param("sssiissii",$ISBN,$Authorsname,
    
28.05.2017 / 23:52