mam pewien problem z moim skryptem, mianowicie gdy uruchomiam go na localhoscie wyświetla sie:
Deprecated: mysql_escape_string(): This function is deprecated; use mysql_real_escape_string() instead. in C:\WebServ\httpd\system\classes\mysql.php on line 188
Deprecated: mysql_escape_string(): This function is deprecated; use mysql_real_escape_string() instead. in C:\WebServ\httpd\system\classes\mysql.php on line 188
Rozumiem z tego że funkcja: mysql_ecape_string() jest przestarzała. Próbowałem wyłączyć komunikaty, ale to nic nie dało. Zmieniałem też na mysql_real_escape_string(). Oto plik mysql.php:
<?php class db{ var $db_id = false; var $query_num = 0; var $mysql_error = ''; var $mysql_version = ''; var $mysql_error_num = 0; var $mysql_extend = "MySQLi"; var $MySQL_time_taken = 0; var $query_id = false; function connect($db_user, $db_pass, $db_name, $db_location = 'localhost', $show_error=1){ $this->db_id = @mysqli_connect($db_location[0], $db_user, $db_pass, $db_name, $db_location[1]); } else { $this->db_id = @mysqli_connect($db_location[0], $db_user, $db_pass, $db_name); } if(!$this->db_id) { if($show_error == 1) { $this->display_error(mysqli_connect_error(), '1'); } else { return false; } } $this->mysql_version = mysqli_get_server_info($this->db_id); { } mysqli_query($this->db_id, "SET NAMES '" . COLLATE . "'"); return true; } function query($query, $show_error=true){ $time_before = $this->get_real_time(); if(!$this->db_id) $this->connect(DBUSER, DBPASS, DBNAME, DBHOST); if(!($this->query_id = mysqli_query($this->db_id, $query) )) { $this->mysql_error = mysqli_error($this->db_id); $this->mysql_error_num = mysqli_errno($this->db_id); if($show_error) { $this->display_error($this->mysql_error, $this->mysql_error_num, $query); } } $this->MySQL_time_taken += $this->get_real_time() - $time_before; $this->query_num ++; return $this->query_id; } function get_row($query_id = ''){ if ($query_id == '') $query_id = $this->query_id; return mysqli_fetch_assoc($query_id); } function get_array($query_id = ''){ if ($query_id == '') $query_id = $this->query_id; return mysqli_fetch_array($query_id); } function super_query($query, $multi = false, $cache_prefix = false, $system_cache = false){ if($cache_prefix){ if($system_cache) $data = system_cache($cache_prefix); else $data = mozg_cache($cache_prefix); } if($data){ if($unSerData) return $unSerData; else } else { if(!$multi) { $this->query($query); $data = $this->get_row(); $this->free(); if($cache_prefix){ mozg_create_cache($cache_prefix, $cache_rows); } return $data; } else { $this->query($query); while($row = $this->get_row()) { $rows[] = $row; } $this->free(); if($cache_prefix){ if($system_cache) creat_system_cache($cache_prefix, $cache_rows); else mozg_create_cache($cache_prefix, $cache_rows); } return $rows; } } } function num_rows($query_id = ''){ if ($query_id == '') $query_id = $this->query_id; return mysqli_num_rows($query_id); } function insert_id(){ return mysqli_insert_id($this->db_id); } function get_result_fields($query_id = '') { if ($query_id == '') $query_id = $this->query_id; while ($field = mysqli_fetch_field($query_id)) { $fields[] = $field; } return $fields; } function safesql( $source ){ if ($this->db_id) return mysqli_real_escape_string ($this->db_id, $source); } function free( $query_id = '' ){ if ($query_id == '') $query_id = $this->query_id; @mysqli_free_result($query_id); } function close(){ @mysqli_close($this->db_id); } function get_real_time(){ return ((float)$seconds + (float)$microSeconds); } function display_error($error, $error_num, $query = ''){ if($query) { $query_str = "$query"; } echo '<?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Błąd!</title> <meta http-equiv="Content-Type" content="text/html; charset=windows-1251" /> </head> <body> <font size="4">Błąd serwera, spróbuj odświeżyć stronę później.</font> </body> </html>'; } } ?>
Prosiłbym o pomoc z tym jak się pozbyć tego komunikatu i by wszystko działało, z góry dziękuje za odpowiedzi. Nie proszę o gotowca poprawionego pliku: mysql.php(chociaż nie będe miał nic przeciwko
