Jump to content

Recommended Posts

Posted

Olá

tenho o seguinte código:

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

Ao correr da-me  o seguinte erro:

Citação

#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?

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.