EASYPHP AND ERROR MESSAGES

Solved
Hello,

the software reports an error like this:

Parse error: syntax error, unexpected 'mysql' (T_STRING), expecting ']' in C:\Program Files (x86)\EasyPHP-Devserver-17\eds-www\Test\minichat.php on line 40

I don’t know if I need to reconfigure the .ini file and if so, where to find it and how to do it, it’s different from WAMP from Microsoft. Thank you for your help.

3 answers

  1. Moderator
    Which line is affected by the error?

    --
    I mainly work in VB6 and VB.NET, with a little C#, but moderation often brings me to other languages.
    In VB.NET, remember to enable "Option Explicit" and "Option Strict."
    0
    1. Hello NHenry !

      // Connecting to the database

      line 40: $bdd = new PDO('mysql:host=127.0.0.1;dbname=chatbd', 'root', ' ');

      Error message:
      Parse error: syntax error, unexpected 'mysql' (T_STRING), expecting ']' in C:\Program Files (x86)\EasyPHP-Devserver-17\eds-www\Test\minichat.php on line 40

      I was told that the password in easyPHP is: mysql ????

      So I tried with the following code and it's still the same

      line 40: $bdd = new PDO('mysql:host=127.0.0.1;dbname=chatbd', 'root', 'mysql ');

      Thank you for your help!
      0
      1. Moderator
        Clearly, the problem is not there.

        It still seems recommended to use "localhost" instead of "127.0.0.1".

        What is the code surrounding the line?
        0
    2. Moderator
      Hello

      First, think about this:
      https://forums.commentcamarche.net/forum/affich-37584941-php-pdo-gerer-les-erreurs

      Then... what do you have on the lines before line 40?
      Given the error message.. I have the impression that you wrote something incorrectly on the previous line

      --
      Best regards,
      Jordane
      0
      1. Thank you Jordane, it's fixed!

        I accidentally deleted "host" in front of "localhost" in the code

        $bdd = new PDO('mysql:localhost;dbname=chatbd', 'root', '');
        instead of:
        $bdd = new PDO('mysql:host=:localhost;dbname=chatbd', 'root', '');

        It's all good now! Thank you!
        0