No connection response PHP [closed]

-2

Good evening, could anyone help me? I'm doing an academic project where I have to link HTML pages and make them pull information from the database.

So far, I have created a table in my database, created a php script to connect and put the form on the html page as a button. When I click the button it brings me the php code on a web page. Can anyone help me?

Note that the file is as php and I'm opening the webpage and on the web page I'm pushing the button.

    
asked by anonymous 11.06.2018 / 03:32

1 answer

1

In DB connection, you are passing a% variable of%, but variable names in PHP can not start with numbers, and in this case, it is not even being declared. I think you wanted to write $123 . The same happens with $senha and $servidor .

$link = mysql_connect($servidor, $usuario, $senha);

Also, I do not know which version of PHP you are using, but $usuario was deprecated in version 5.5.0 and removed in version 7.0.0. From documentation :

  

This extension was deprecated in PHP 5.5.0, and it was removed in PHP 7.0.0

FUNCTION mysql_connect

You can use mysqli_connect (note i next to the word mysql - i is improved / improved).

$link = mysqli_connect($servidor, $usuario, $senha, $banco);

Optionally, you can use mysqli_connect to connect to the DB. In this case, do not add the parameter mysqli_select_db to $banco .

MORE FUNCTIONS

You can search for more functions in the PHP documentation here . There is even the option to use the class mysqli_connect (object orientation).

    
11.06.2018 / 03:57