Hướng dẫn is mysql_real_escape_string deprecated? - mysql_real_escape_string có bị phản đối không?

Tôi đang chạy một ứng dụng web trong Codeigniter chạy trên máy chủ. Ở đây tôi là một mẫu đăng ký người dùng, hoạt động tốt trong localhost. Nhưng khi nói đến máy chủ, khi tôi cố gắng đăng ký người dùng, trang của tôi sẽ hiển thị lỗi:

mysql_escape_string() function is deprecated use mysql_real_escape_string() in mysql/mysql_driver

Tôi đã thử thay đổi trang mysql_driver của mình nhưng sau khi thay đổi mọi thứ trở nên trống rỗng. Bất cứ ai có thể giúp tôi giải quyết lỗi này?

Hỏi ngày 10 tháng 1 năm 2015 lúc 5:40Jan 10, 2015 at 5:40

Hướng dẫn is mysql_real_escape_string deprecated? - mysql_real_escape_string có bị phản đối không?

6

Nếu bạn đang sử dụng Php 5.4, hàm mysql_escape_string () sẽ không dùng nữa. Vì vậy, bạn cần thực hiện một số thay đổi trong tệp trình điều khiển mysql. Mã này:

/**
  * Escape String
  *
  * @param string
  * @param bool whether or not the string will be used in a LIKE condition
  * @return string
  */
 public function escape_str($str, $like = FALSE)
 {
  if (is_array($str))
  {
   foreach ($str as $key => $val)
      {
    $str[$key] = $this->escape_str($val, $like);
      }

      return $str;
     }

  $str = is_resource($this->conn_id) ? mysql_real_escape_string($str, $this->conn_id) : addslashes($str);

  // escape LIKE condition wildcards
  if ($like === TRUE)
  {
   return str_replace(array($this->_like_escape_chr, '%', '_'),
      array($this->_like_escape_chr.$this->_like_escape_chr, $this->_like_escape_chr.'%', $this->_like_escape_chr.'_'),
      $str);
  }

  return $str;
 }

Nó có thể giúp bạn ...

Đã trả lời ngày 10 tháng 1 năm 2015 lúc 5:45Jan 10, 2015 at 5:45

Hướng dẫn is mysql_real_escape_string deprecated? - mysql_real_escape_string có bị phản đối không?

0

Hướng dẫn mysql escape string

Các hàm trên thuộc về nhóm hàm, chúng ta dùng để bảo mật/ bảo vệ website. Một dữ liệu khi được thêm vào database có thể có 2 khả năng xấu như sau: Đang ...

Hướng dẫn mysql escape string

What is use of addslashes in php?

(PHP 4, PHP 5, PHP 7, PHP 8)addslashes — Quote string with slashesDescriptionaddslashes(string $string): stringsingle quote ()double quote ()backslash ()NUL (the NUL byte) A use case ...

Hướng dẫn dùng escape quote trong PHP

(PHP 4, PHP 5, PHP 7, PHP 8)addslashes — Quote string with slashesDescriptionaddslashes(string $string): stringsingle quote ()double quote ()backslash ()NUL (the NUL byte) A use case of ...

Hướng dẫn mysql_real_escape_string in laravel

Python log10 math domain errorI have to use Python math.log(x) function with values of x from (0, ..., 1). Sometimes x may be too close to zero, and Python gives me an error:ValueError: math domain ...

Hướng dẫn webkit-text-stroke-width css

The -webkit-text-stroke-width CSS property specifies the width of the stroke for text.Syntax/* Keyword values */ -webkit-text-stroke-width: thin; -webkit-text-stroke-width: ...

Hướng dẫn sqli php

I. Hướng dẫn cơ bản khai thác SQL Injection đối với MySQL Demo: Khai thác SQL Injection trong Basic PHP Events Lister 1.0 Đầu tiên với ...

How can i see sql query error in php?

❮ PHP MySQLi ReferenceExample - Object Oriented styleReturn the last error description for the most recent function call, if any:

Php call dynamic function with arguments

Hướng dẫn reshape image python

Im trying to reshape an image into the size I want. There is an image dataset I got online and the shape of each image in the dataset is (3, 128, 128).I want the shape of each image to be (128, 128, ...

Php modify xml file simplexml

How can I edit the values in a xml file using simpleXML ? I know how to create the file, but not how to edit the value in an existing file ? srb1731 silver badge6 bronze badges asked Jan 19, 2010 ...

Mysql escape string la gì

Các hàm trên thuộc về nhóm hàm, chúng ta dùng để bảo mật/ bảo vệ website. Một dữ liệu khi được thêm vào database có thể có 2 khả năng xấu như sau: Đang ...