I put a code page on my site that looks for information from the database but on the file that connects to the DB and pulls the relevant information giving a supposed extension error. This error does not appear in localhost only when it is hosted on an online server. The error generated is this:
Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /CSS/function/conecta.coment.php on line 22
The code of the page:
<?php
//base de dados de teste
$dbhost = 'mysql.hostinger.com.br'; // endereco do servidor de banco de dados
$dbuser = 'u28*******_fraex'; // login do banco de dados
$dbname = 'u28*******_fraex'; // nome do banco de dados a ser usado
$dbpass = '**********'; // senha
$conecta = mysql_connect($dbhost, $dbuser, $dbpass, $dbname);
$seleciona = mysql_select_db($dbname);
// cria a instrução SQL que vai selecionar os dados
$query = sprintf("SELECT user_name, comentario FROM comentario ORDER BY coment_id desc limit 5");
// executa a query
$dados = mysql_query($query, $conecta) or die(mysql_error());
// transforma os dados em um array
$linha = mysql_fetch_assoc($dados);
// calcula quantos dados retornaram
$total = mysql_num_rows($dados);
?>
How can I resolve this?