$hostnome = '192.185.176.204';
$usernome = 'tookc892';
$senha = '***';
$dbname = 'nome_banco';
$conexao = mysql_connect("$hostnome", "$usernome", "$senha");
$sel_banco = mysql_select_db("$dbname");
Forgot semicolon after variable $password;
We still have to select the database...
You must run $connected, then you could leave without setting it, so:
$hostnome = '192.185.176.204';
$usernome = 'tookc892';
$senha = '***';
$dbname = 'nome_banco';
mysql_connect("$hostnome, $usernome, $senha");
mysql_select_db("$dbname");
IN PDO:
<?php
//Arquivo de conexão com o Banco de Dados
try{
$driver = 'mysql';
$host = '192.185.176.204';
$usuario = 'tookc892';
$senha = '***';
$dbname = 'nome_banco';
$conn = new PDO("$driver:host=$host;dbname=$dbname", $usuario, $senha);
} catch (PDOException $e){
echo "Erro ao conectar no banco de dados $dbname <BR/>";
echo $e->getMessage();
die();
}
?>
Enter the snippet of the code that presents the problem, so we can check.
– Ricardo
There’s a very strange text in the middle... (?)
– brasofilo
$hostname = '192.185.176.204'; $usernome = 'tookc892'; $password = '**' $connected= mysql_connect( '$hostname', '$usernome', '$password'); // the password did not set there any more correct here
– PatiiHenrii
Do you know you can accept answers? See tour. You can accept an answer per question you asked. You can even accept your answer if it was the one that helped you best.
– MateusDemboski
There are two possible reasons: 1st mysql_query is being discontinued, 2nd you may be entering an infinite connection loop.
– Ivan Ferrer