Parse error: syntax error, unexpected '=' [closed]

0

I'm building a connection to the database, but I get this error: Parse error: syntax error, unexpected '=' in C: \ wamp64 \ www \ login \ connection.php on line 2

Code:

<?php
@connect = mysql_connect("localhost","root","") or die ("Erro na conexão");
mysql_select_db("tcc")or die ("Base não encontrada")
?>

Any ideas?

    
asked by anonymous 06.12.2016 / 22:53

1 answer

5

PHP variables should be prefixed with $ and not with @ . Just change the code to:

<?php
    $connect = mysql_connect("localhost","root","") or die ("Erro na conexão");
    mysql_select_db("tcc") or die ("Base não encontrada")
?>

@ is meant to suppress errors, if that was your intention, read #

Note:

As has been said many times here on the site, it is not advisable to use the mysql functions, they are obsolete, mysqli is to replace them.

See more at

06.12.2016 / 23:07