Hướng dẫn mysql_error in php - mysql_error trong php

[Php 4, Php 5]

mysql_error - Trả về văn bản của thông báo lỗi từ hoạt động MySQL trước đóReturns the text of the error message from previous MySQL operation

Sự mô tả

mysql_error [tài nguyên $link_identifier = null]: Chuỗi[resource $link_identifier = NULL]: string

Thông số

link_identifier

Kết nối MySQL. Nếu định danh liên kết không được chỉ định, liên kết cuối cùng được mở bởi mysql_connect [] được giả định. Nếu không tìm thấy liên kết như vậy, nó sẽ cố gắng tạo một liên kết như thể mysql_connect [] đã được gọi mà không có đối số. Nếu không tìm thấy kết nối hoặc thiết lập, lỗi cấp E_WARNING được tạo ra.mysql_connect[] is assumed. If no such link is found, it will try to create one as if mysql_connect[] had been called with no arguments. If no connection is found or established, an E_WARNING level error is generated.

Trả về giá trị

Trả về văn bản lỗi từ hàm MySQL cuối cùng hoặc '' [chuỗi trống] nếu không xảy ra lỗi.

Ví dụ

Ví dụ #1 mysql_error [] ví dụmysql_error[] example

Ví dụ trên sẽ xuất ra một cái gì đó tương tự như:

1049: Unknown database 'nonexistentdb'
1146: Table 'kossu.nonexistenttable' doesn't exist

Xem thêm

  • mysql_errno [] - Trả về giá trị số của thông báo lỗi từ thao tác MySQL trước đó
  • »& NBSP; Mã lỗi MySQL

Aleczapka _at] gmx dot net ¶

18 năm trước

If you want to display errors like "Access denied...", when mysql_error[] returns "" and mysql_errno[] returns 0, use  $php_errormsg. This Warning will be stored there.  You need to have track_errors set to true in your php.ini.

Note. There is a bug in either documentation about error_reporting[] or in mysql_error[] function cause manual for mysql_error[], says:  "Errors coming back from the MySQL database backend no longer issue warnings." Which is not true.

Florian Sidler ¶

12 năm trước

Be aware that if you are using multiple MySQL connections you MUST support the link identifier to the mysql_error[] function. Otherwise your error message will be blank.

$link_identifier0

Lâu đài Pendragon

13 năm trước

$link_identifier2

$link_identifier3

$link_identifier4

$link_identifier5

Ẩn danh ¶

17 năm trước

$link_identifier6

$link_identifier7

$link_identifier8

$link_identifier9

link_identifier0

link_identifier1

link_identifier2

l dot poot tại twing dot nl ¶

16 năm trước

link_identifier4

link_identifier5

link_identifier6

link_identifier7

link_identifier8

link_identifier9

E_WARNING0

E_WARNING1

E_WARNING2

Olaf tại Amen-Online Dot de ¶

18 năm trước

E_WARNING3

E_WARNING4

Florian Sidler ¶

12 năm trước

E_WARNING6

E_WARNING7

E_WARNING8

Ẩn danh ¶

17 năm trước

''0

''1

''2

l dot poot tại twing dot nl ¶

16 năm trước

''4

''5

''6

''7

''8

''9

0

Olaf tại Amen-Online Dot de ¶

16 năm trước

2

3

Olaf tại Amen-Online Dot de ¶

12 năm trước

5

6

7

8

9

Florian Sidler ¶

12 năm trước

If you want to display errors like "Access denied...", when mysql_error[] returns "" and mysql_errno[] returns 0, use  $php_errormsg. This Warning will be stored there.  You need to have track_errors set to true in your php.ini.1

If you want to display errors like "Access denied...", when mysql_error[] returns "" and mysql_errno[] returns 0, use  $php_errormsg. This Warning will be stored there.  You need to have track_errors set to true in your php.ini.2

If you want to display errors like "Access denied...", when mysql_error[] returns "" and mysql_errno[] returns 0, use  $php_errormsg. This Warning will be stored there.  You need to have track_errors set to true in your php.ini.3

If you want to display errors like "Access denied...", when mysql_error[] returns "" and mysql_errno[] returns 0, use  $php_errormsg. This Warning will be stored there.  You need to have track_errors set to true in your php.ini.4

If you want to display errors like "Access denied...", when mysql_error[] returns "" and mysql_errno[] returns 0, use  $php_errormsg. This Warning will be stored there.  You need to have track_errors set to true in your php.ini.5

Lâu đài Pendragon

13 năm trước

If you want to display errors like "Access denied...", when mysql_error[] returns "" and mysql_errno[] returns 0, use  $php_errormsg. This Warning will be stored there.  You need to have track_errors set to true in your php.ini.6

If you want to display errors like "Access denied...", when mysql_error[] returns "" and mysql_errno[] returns 0, use  $php_errormsg. This Warning will be stored there.  You need to have track_errors set to true in your php.ini.7

If you want to display errors like "Access denied...", when mysql_error[] returns "" and mysql_errno[] returns 0, use  $php_errormsg. This Warning will be stored there.  You need to have track_errors set to true in your php.ini.8

If you want to display errors like "Access denied...", when mysql_error[] returns "" and mysql_errno[] returns 0, use  $php_errormsg. This Warning will be stored there.  You need to have track_errors set to true in your php.ini.9

Note. There is a bug in either documentation about error_reporting[] or in mysql_error[] function cause manual for mysql_error[], says:  "Errors coming back from the MySQL database backend no longer issue warnings." Which is not true.0

Note. There is a bug in either documentation about error_reporting[] or in mysql_error[] function cause manual for mysql_error[], says:  "Errors coming back from the MySQL database backend no longer issue warnings." Which is not true.1

Note. There is a bug in either documentation about error_reporting[] or in mysql_error[] function cause manual for mysql_error[], says:  "Errors coming back from the MySQL database backend no longer issue warnings." Which is not true.2

Bài Viết Liên Quan

Chủ Đề