Pagina 1 din 1

Eroare mysql_connect extension is deprecated

Scris: Mie Oct 14, 2015
de DanuTz1987
salutare imi da o erroare la index pagini, am pus tot ce trebuie, lipseste ceva?
Ma poate ajuta cineva ?

Cod: Selectaţi tot

Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /home/rohostin/public_html/includes/dbconnect.php on line 26

Warning: Cannot modify header information - headers already sent by (output started at /home/rohostin/public_html/includes/dbconnect.php:26) in /home/rohostin/public_html/index.php on line 60

Cod: Selectaţi tot

<?php
	error_reporting(E_ALL ^ E_NOTICE);
/******************************************************************************
#                      
#******************************************************************************
#      Author:     
#      Email:      
#      Website:    
#	
#
#      Version:    2.0
#      Copyright:  (c) 2009 - 
#	   Icons from PixelMixer /
#      
#*******************************************************************************/
	$script_dir = '/public_html/'; // IF IN ROOT leave like this: '/'  if in root/files   then    '/files/'
	$upload_dir = '/uploads/'; //NOTE: TRAILING FORWARD SLASHES! FULL PATH to current folder relative to root, DON'T FORGET TO SET permissions for this folder to 777 on UNIX servers.
	$upload_notify_email = 'suport@sitemeu '; //email for notifications of new file upload.
	$db_host = 'localhost'; //hostname
    $db_user = 'rohostin_rohosti'; // username
    $db_password = 'rohostingro'; // password
    $db_name = 'rohostin_rohostingro'; //database name
	
	$demo = false;
	
	$link = mysql_connect($db_host, $db_user, $db_password) or die("1. Open dbconnect.php and edit mysql variables. <br/> 2. Run install.php ");
	@mysql_select_db($db_name);
	 mysql_query("SET NAMES utf8") or die("err: " . mysql_error());
ce as putea face pentru a nu mai da erroare aia?
Va Multumesc de ajutor

Eroare mysql_connect extension is deprecated

Scris: Mie Oct 14, 2015
de MarPlo
Salut
E un script cam vechi ce nu mai e compatibil cu actualul PHP. Trebuie sa modifici scriptul; mai exact, tot ce e legat de conectare la mysql, sa folosesti MySQLi sau PDO, fiindca functia mysql_connect() a fost anulata din noile versiuni PHP.
Daca scriptul e mare, poate fi destul de complicat, si trebuie sa cunosti cum sa treci la PDO sau MySQLi.

- O alta solutie, care nu rezolva problema, dar face sa nu mai arate mesajele de eroare, e aceasta:
Inlocuieste codul:

Cod: Selectaţi tot

error_reporting(E_ALL ^ E_NOTICE);
Cu acesta:

Cod: Selectaţi tot

ini_set('display_errors', 0);
error_reporting(0); 
- Daca tot mai apare mesajul de eroare, adauga caracterul: @ in fata la toate functiile care incep cu "mysql_", de exemplu:

Cod: Selectaţi tot

$link = @mysql_connect($db_host, $db_user, $db_password);
//...
@mysql_query("SET NAMES utf8"); 

Eroare mysql_connect extension is deprecated

Scris: Mie Oct 14, 2015
de DanuTz1987
merge... nu mai da nici o erroare. Multumesc