mysql_websocket_chat icon indicating copy to clipboard operation
mysql_websocket_chat copied to clipboard

Error in enabling database

Open badguyp opened this issue 3 years ago • 7 comments

Expected behavior

Actual behavior

WL@`F%2 6IBXH@1ST%XOGH9

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

badguyp avatar May 19 '21 03:05 badguyp

Hi badguyp,

I have noticed and fixed this bug in version 1.5. But I will try to release a fix for you today.

johnnymast avatar May 19 '21 08:05 johnnymast

Update: Inserts for private chat and public chat have manually been tested.

johnnymast avatar May 19 '21 09:05 johnnymast

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

johnnymast avatar May 19 '21 10:05 johnnymast

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
        ]
    );
}

image Thank you again for your answer to my question, and at the end, please forgive me for my poor English.

badguyp avatar May 20 '21 09:05 badguyp

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.

johnnymast avatar May 20 '21 17:05 johnnymast

Hello johnnymast, Version 1.5 is too timely, this must be a great project

badguyp avatar May 21 '21 01:05 badguyp

That is true but i also have 97 repos to take care of :)

johnnymast avatar Dec 16 '21 19:12 johnnymast