Jump to content

Erro em query de update

Diana Madeira

Recommended Posts


tenho o seguinte código:

    $_SESSION['message'] ='';

        $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']);
        $price= $conn->real_escape_string($_POST['price']);
            $sql= "UPDATE SET books (ISBN, Authorsname, Title, edition, year, category, publisher, quantityinstock, price) VALUES(".$ISBN.",'".$Authorsname."', '".$Title."', ".$edition.", ".$year.", '".$category."', '".$publisher."', ".$quantityinstock.",".$price.")";
        echo '<h3><font color="red">You have successfully updated </font></h3>';
                echo 'Error';
                echo $sql;

Ao correr da-me  o seguinte erro:


#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SET books (ISBN, Authorsname, Title, edition, year, category, publisher, quantit' at line 1 

Alguma ideia como resolver isto?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.