mercredi 29 août 2018

Parse error: syntax error, unexpected 'if' (T_IF) on if statement [duplicate]

This question already has an answer here:

I am trying to update my database and im getting "Parse error: syntax error, unexpected 'if' (T_IF)" on my second if statement and i cant seem to find the error. Please do help me. Thank you.

Here's my code:

 <?php
include('../connect.php');

if (isset($_POST['update'])) {
    $name = $_POST['stockname'];
    $code = $_POST['stockcode'];
    $des= $_POST['stockdes'];

    $sql = mysqli_query($conn, "UPDATE SIInfo SET StockName = '$name', ProductCode='$code', StockDescription = '$des' ")

    **if ($sql)** {
        echo "<script>alert ('Record Updated!')</script>;";
        include ('../SI/selectSI.php');

    }else{
        echo "<script>alert ('Error! Failed to update.')</script>;";
        include ('../SI/selectSI.php');
    }


}     

?>

Aucun commentaire:

Enregistrer un commentaire