mysql_websocket_chat
mysql_websocket_chat copied to clipboard
Error in enabling database
Expected behavior
Actual behavior
Steps to reproduce the behavior
1.Download the project code 2.Create database 3.Turn on ENABLE_DATABASE(define('ENABLE_DATABASE', TRUE);) My php version 7.3 My mysql version 5.7 If you can hope for a reply, thank you
Hi badguyp,
I have noticed and fixed this bug in version 1.5. But I will try to release a fix for you today.
Update: Inserts for private chat and public chat have manually been tested.
A new release is out. Could you reimport the database table (I updated the import file) and verify it works now for you? Once verified I close the issue. Thanks in advance @badguyp
Hi johnnymast, I have seen the repaired version and it is very good I also tried to simply repair the Database.php file. public function insert( $to_id = 0, $from_id = 0, $message = '', $ip_address = '' ): void { $statement = $this->prepare( "INSERT INTO chat_interactions SET to_id = :to_id, from_id = :from_id, message = :message, ip_address = :ip_address" );
$statement->execute(
[
'to_id' => isset($to_id->id)?$to_id->id:$to_id,
'from_id' => $from_id,
'message' => $message,
'ip_address' => $ip_address
]
);
}
Thank you again for your answer to my question, and at the end, please forgive me for my poor English.
Hello badguyp,
I think in newer php versions (7 and up) this style of code could also be fixed with the following line.
$statement->execute(
[
'to_id' => $to_id ?? null,
'from_id' => $from_id,
'message' => $message,
'ip_address' => $ip_address
]
);
PS: Your English is good enough for me. I hope you enjoy your update, I am still working on a 1.5 update that will bring SSL and docker support for the project.
Hello johnnymast, Version 1.5 is too timely, this must be a great project
That is true but i also have 97 repos to take care of :)