• 0
Sign in to follow this  
Flavia Promocoes

erro ao conectar ao banco

Question

Warning: mysql_connect() [function.mysql-connect]: Headers and client library minor version mismatch. Headers:50540 Library:50622 in /home/alfa87fm/public_html/central/config.php on line 9

Este é o codigo do PHP

<?php

//Arquivo para efetuar conexão ao banco de dados
$host = "localhost"; //Servidor do mysql
$user = "alfa87fm_radio"; //Usuario do banco de dados
$senha = "xxxxxx"; //senha do banco de dados
$db = "alfa87fm_radio"; //banco de dados
$conexao = mysql_connect($host, $user, $senha) or die (mysql_error());
mysql_select_db($db) or die (mysql_error());
?>

Share this post


Link to post
Share on other sites

2 answers to this question

Recommended Posts

  • 0

se a versão da PHP é 5.5 ou mais recente, essas funções (mysql*) estão obsoletas;

use PDO:

http://www.devmedia.com.br/introducao-ao-php-pdo/24973
http://www.rafaelwendel.com/2011/12/tutorial-pdo-php-data-object/

mas tem que ver se as extensões (AO mysql e a PDO, são duas) estão instaladas tb, ok?

(pelo phpinfo() em seu computador ou na hospedagem, se for o caso)..

falou.. fui.. :)

Share this post


Link to post
Share on other sites
  • 0

Muda

$conexao = mysql_connect($host, $user, $senha) or die (mysql_error());
mysql_select_db($db) or die (mysql_error());
para
$conexao = @mysql_connect($host, $user, $senha) or die (mysql_error());
$conn = @mysql_select_db($db) or die (mysql_error());

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this