开发者

How do I fix this parse error in my PHP code? [closed]

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center. Closed 9 years ago.

I just started PHP and I want to know how to fix this parse error. This is the error:

Parse error: parse error in E:\wamp\www\PHP\create.php on line 22

And here is my code. By the way, I'm making a database manipulating system, and I use WampServer and Dreamweaver.

<?php
    include 'E:\wamp\www\PHP\connection.php';

    $IDNUMBER = $_POST['ID'];
    $LNAME = $_POST['Lname'];
    $FNAME = $_POST['Fname'];
    $MNAME = $_POST['Mname'];
    $GRADEYR = $_POST['GradeYr'];
    $ADDRESS = $_POST['Address'];

    if (!$_POST['submit']) {
        echo "please fill out the form";
        header('Location: E:\wamp\www\PHP\main.php');
    开发者_高级运维} else {

        mysql_query = "INSERT INTO  students (`IDNUMBER`,`LNAME` ,`FNAME` ,`MNAME` ,`GRADEYR` ,`ADDRESS`)
        VALUES (NULL, '$IDNUMBER', '$LNAME', '$FNAME', '$MNAME', '$GRADEYR', '$ADDRESS')") or die(mysql_error());

        echo "User has been added!";
        header('E:\wamp\www\PHP\main.php');


    }

?>


mysql_query = "INSERT ....") or die(...);

You have an extra closing ")"; Remove it from there.

The code shoult look like mysql_query("INSERT ....") or die(...);

if you want to insert something into the DB:)


mysql_query = "...

should be

mysql_query(...)


You also likely forgot to escape / sanitize the user input...

If the name or an address contains an ' you might have issues


'$ADDRESS')") you have an extra bracket here. Check it dude.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜