I can't seem to fix this, Although i feel it is an issue with my syntax. Any help would be greatly appreciated.

'Parse error: syntax error, unexpected ',', expecting ']' in line 12' is the error being displayed.

?php
if ( ! empty( $_POST ) ) {

    $mysqli = new mysqli('localhost', '111', '111', '111' );

    if ( $mysqli->connect_error ){
        die('connect error: ' . $mysqli->connect_errno. ': ' . $mysqli->connect_error );
    }

    $sql = "INSERT INTO processcv ( Name, Surname, Tel, Email, Message, CVtype) VALUES 
    ( '{$mysqli->cubrid_real_escape_string($_POST['Name'])}','
    ( '{$mysqli->cubrid_real_escape_string($_POST['Surname])}','
    ( '{$mysqli->cubrid_real_escape_string($_POST['Tel'])}','
    ( '{$mysqli->cubrid_real_escape_string($_POST['Email'])}','
    ( '{$mysqli->cubrid_real_escape_string($_POST['Message'])}',
    ( '{$mysqli->cubrid_real_escape_string($_POST['CVtype'])}' )";
    $insert = $mysqli->query($sql);

    if ( $insert ){
    echo "success! Row ID: {$mysqli->insert_id}";
    } else{
    die("error: {$mysqli->errno} : {$mysqli->error}");
    }

    $mysqli->close();

}
?>

1 Answers

0
Varun Malhotra On

Their was syntax error unexpected use of ' and way of variables called please check below

<?php
if ( ! empty( $_POST ) ) {

    $mysqli = new mysqli('localhost', '111', '111', '111' );

    if ( $mysqli->connect_error ){
        die('connect error: ' . $mysqli->connect_errno. ': ' . $mysqli->connect_error );
    }

    $sql = "INSERT INTO processcv ( Name, Surname, Tel, Email, Message, CVtype) VALUES 
    ( '".$mysqli->cubrid_real_escape_string($_POST['Name'])."'),
    ( '".$mysqli->cubrid_real_escape_string($_POST['Surname'])."'),
    ( '".$mysqli->cubrid_real_escape_string($_POST['Tel'])."'),
    ( '".$mysqli->cubrid_real_escape_string($_POST['Email'])."'),
    ( '".$mysqli->cubrid_real_escape_string($_POST['Message'])."'),
    ( '".$mysqli->cubrid_real_escape_string($_POST['CVtype'])."')";
    $insert = $mysqli->query($sql);

    if ( $insert ){
    echo "success! Row ID: {$mysqli->insert_id}";
    } else{
    die("error: {$mysqli->errno} : {$mysqli->error}");
    }

    $mysqli->close();

}
?>