之前没有错误的PHP错误500

时间:2016-10-20 21:11:57

标签: php

有一个PHP脚本工作得很好,我没有在一周内触及它,我今天再次尝试,现在我只是得到一个错误。不确定导致错误的是什么,我已经编写了php,所以它应该可以正常工作。

<head>
    <title>Information Gathered</title>
</head>

<body>

    <?php 

    echo "<p>Data Processed!</p>";

    $song = $_POST['song'];
    $artist = $_POST['artist'];
    $album = $_POST['album'];       
    $year = $_POST['year'];
    $genre = $_POST['genre'];

    echo $song . "</br>";
    echo $artist . "</br>";
    echo $album . "</br>";
    echo $year . "</br>";
    echo $genre . "</br>";

    DEFINE ('DB_USER', '*****');
    DEFINE ('DB_PASSWORD', '*****');
    DEFINE ('DB_HOST', '*****');
    DEFINE ('DB_NAME', '******');

    $dbc = @mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME)
    OR die('Could not connect to MySQL: ' .
    mysqli_connect_error());

    $sql = "insert into music (song, artist, album, year genre)
            values('$song', '$artist', '$album', '$year', '$genre',)";
    $dbc->query($sql)
    echo "<p> Data Entered!!!</p>"

    ?>

</body>

1 个答案:

答案 0 :(得分:1)

我不确定PHP错误,但您的SQL查询有错误

应该是

insert into music (song, artist, album, year, genre)
values('$song', '$artist', '$album', '$year', '$genre')

你的逗号放错了地方。