I'm creating a chat system and after watching some tutorials on youtube I thought the chat system would work but it returned an error:

Parse error: syntax error, unexpected 'idUsers' (T_STRING) in *..path to chat file on line 84.

He doesn't expect the 'idUsers' there, while it is just a column in my database.

I looked on phpcodechecker and they told me I would miss a semicolon. But in the example code I will add the semicolon is present.

    <?php      include("PHPSQL/dbh.PHPSQL.php");
if(isset($_POST['submit'])) {
    $message = $_POST['message'] ;

    $q= 'INSERT INTO message ('idUsers', 'message', 'uidUsers')
    VALUES("", "'.$message.'", ".$_SESSION['uidUsers'].'")

The database handler which connects my website to the database has this code:


$conn = mysqli_connect($servername, $dBUsername, $dBPassword, $dBName);
<!-- if statement for when the connection failed-->

In my login system, which I already created I had the same kind of code and that login system is now perfectly working, but the chat system doesn't.

0 Answers