ERROR: Incorrect function

-1

I developed a portal and it works correctly on localhost, but when I went to put it in the air, the connection to the bank stopped working. So when trying to connect to the bank he does not log into the portal, he just opens a blank page written Incorrect Function . I can not figure out why this occurs, at first the connection is correct. Here is the connection:

  $conexao = mysqli_connect('mysql.site.com.br','user','12345') or print(mysqli_error());
  $db      = mysqli_select_db($conexao, 'banco_teste') or print(mysqli_error());

I accept suggestions of what I can do to work. Thank you!

    
asked by anonymous 15.02.2017 / 21:59

1 answer

3

mysqli_select_db () "should only be used to change the default database defined in" mysqli_connect () ", you should set the database data in the 4th parameter of " mysqli_connect () " , ie

$conexao = mysqli_connect('mysql.site.com.br','user','12345', 'banco_teste') or die(mysqli_error());

I also leave the hint to replace the " print (mysqli_error ()) " with " die () ", so you already have PHP code running prevents future errors and a gigantic log of errors saved on the server.

    
16.02.2017 / 02:31