ERROR: Incorrect function

Asked

Viewed 151 times

-1

I developed a portal and it works properly on the localhost, but when I went to put it on the air, the connection to the bank stopped working. So when trying to make the connection with the bank it does not log in to the portal, just opens a blank page written Incorrect Function. I can’t figure out why this occurs, at first the connection is correct. Below 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!

  • Need to check the apache error log.

  • And how can I do that?

  • 1

    Already compared local and external PHP versions?

  • I don’t know how to find out the external version of the site already know.

  • I had a similar problem, and it was a PHP version. Try to check this out.

  • Okay, thanks for the suggestion. I’ll try to find out

  • The problem really was the PHP version.

Show 2 more comments

1 answer

3

The function "mysqli_select_db()" should only be used to change the default database defined in "mysqli_connect()", you must define the database in the 4th parameter of the "mysqli_connect()", that is to say,

$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())" for "die()", thus you already terminate the PHP code from running and avoid future errors and a gigantic log of errors saved on the server.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.