Parse error: syntax error, unexpected ';', expecting ',' or ')' ... on line 5

1

I would like to know where the error is, since I am half an hour ago trying to solve it, thank you very much.

Code:

mysql_pconnect('localhost','root';'');
    
asked by XxblackechoxX 15.02.2018 в 00:04
source

2 answers

2

Your problem is the ; that you have after 'root' must be ,

mysql_pconnect('localhost','root','');

Also this extension was declared obsolete in PHP 5.5.0 and deleted in PHP 7.0.0. You should use the MySQLi or PDO_MySQL extensions

Documentation: link

    
answered by 15.02.2018 в 00:22
2

The parameters of a method or function in PHP (and in other languages of the same family such as C, JS, etc.) are separated by commas .

A syntax error indicates that you are using an incorrect character in a certain place and usually indicates correctly the line number in which it occurs, although it may come from a preceding line.

In the specific case of your error:

  

Parse error: syntax error, unexpected ';', expecting ',' or ')' ... on   line 5

A semicolon character is found when you wait for a comma (sign of separation of parameters) or a closing of parentheses, which would indicate that you are not going to pass more parameters to the function. The analyzer does not go beyond the syntax of the language, that is, the number of parameters expected to receive a certain function is not analyzed, only that the code is correctly constructed according to the syntactic norms of the PHP language.

    
answered by 15.02.2018 в 00:18