Home > Blockchain >  Parse error: syntax error, unexpected token "else" in
Parse error: syntax error, unexpected token "else" in

Time:10-09

Beginner at this - apologies for asking. My error is "Parse error: syntax error, unexpected token "else" in... on line 88"

My php is

"4134947_suteki";

// Create connection $connection = new mysqli($servername, $username, $password, $dbname); $db = mysqli_select_db($connection,'XXXXXX');

if(isset($_POST['insert'])); { $item_title = $_POST['item_title']; $qty = $_POST['qty']; $cust_first_name = $_POST['cust_first_name']; $cust_last_name = $_POST['cust_last_name']; $phone = $_POST['phone']; $street = $_POST['street']; $city = $_POST['city']; $postcode = $_POST['postcode'];

    $query = "INSERT INTO 'order_total'('item_title', 'qty', 'cust_first_name', 'cust_last_name', 'phone', 'street', 'city',

'postcode') VALUES ('$item_title', '$qty', '$cust_first_name',' $cust_last_name', '$phone', '$street', '$city', '$postcode')"; $query_run = mysqli_query($connection, $query);

    if($query_run);
    {
    echo '<script type="text/javascript"> alert("Data Saved") </script>';
    }
    
    else { 
    echo '<script type="text/javascript">alert("Data Not Saved")</script>';
    }
     }

?>

Any assistance would be greatly appreciated

the link is also http://suteki.atwebpages.com/order1.php

CodePudding user response:

Please check your if statement if(isset($_POST['insert']));{ there is unnecessary ; which is invalid.

CodePudding user response:

delete ; after if condition

if($query_run);

make it like this

if($query_run)
  • Related