Fatal Error Connecting to Mysql

Asked

Viewed 53 times

0

I’m getting an error when connecting to database

Php code:

<?php
	$siteA = 'http://www.'.$_SERVER['SERVER_NAME'].'/';
	$siteB = '/';
	$email_suporte_staff = '[email protected]';

	global $siteB;
	global $siteA;

	$config_bd = array(
		'host' => 'meuhost',
		'db' => 'database',
		'usuario' => 'databaseuser',
		'senha' => 'password',
	);
    error_reporting (E_ALL & ~ E_NOTICE & ~ E_DEPRECATED);
	$conect = mysql_connect($config_bd['host'], $config_bd['usuario'], $config_bd['senha']);
	if($conect)
	{
		mysql_select_db($config_bd['db']);
		mysql_set_charset('utf8');
	}
	else
	{
		echo '<center><b>config/config.php</b> nao configurado.</center>';
		exit;
	}
?>

  • Ask the error message. And start studying the functions mysqli or PDO. The functions mysql are already obsolete and have been removed from PHP 7.

  • vlw when you mentioned about Php 7 I remembered that the script was done in 5 ai I installed it and it worked

No answers

Browser other questions tagged

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