Lỗi call to undefined function mysql_connect xampp

  • 2

This extension was deprecated in PHP 5.5, and it was removed in PHP 7

Use mysqli_connect instead.

for example:

PHP:

mysqli_connect["127.0.0.1", "my_user", "my_password", "my_db"];

  • 3

I install older version and now it works but i have new problem : Deprecated: Function eregi[] is deprecated in C:\xampp\htdocs\class\iobox.php on line 105

public $attrs; public function __construct[$name]{ foreach[ array_keys[$_POST] as $key]{ if [eregi['^'.$name.'__',$key]]{ $p = explode['__', $key]; $this->attrs[$p[1]] = trim[$_POST[$key]]; } }

  • 4

It has been deprecated for a good reason, don't use a old version of PHP because of that.

  • 5

Using anything built in the 5.x era will break numerous things when there are deprecated functions being used. Downgrading your PHP version wouldn't be much of a problem, but there are other potential security risks you're opening up at that moment.

PHP Connect to MySQL [check this guide for database related stuff] PHP: eregi - Manual [deprecated since 5.3, removed in 7]

  • 6

Im creating server for me only but i wamt a my accoount not 1/1

Installed on MacOS fine, phpMyAdmin running OK, and I've created a database with tables I want to access from PHP, however when I try and connect from a PHP script using the mysql_connect[] method I get :

Call to undefined function mysql_connect[]

Am I missing something here, I thought the whole point of XAMPP was it was configured out of the box to allow this ?

Đây là lỗi WordPress phổ biến khi bạn cài đặt WordPress, phiên bản nâng cấp WordPress được tối ưu cho bản nâng cấp PHP mới như 7.0+ và nó không còn hỗ trợ cho phiên bản cũ [vd PHP 5.4]. Do đó bạn gặp phải lỗi không tìm thấy hàm mysql_connect.

Lỗi PHP Fatal error: Uncaught Error: Call to undefined function mysql_connect[]

Để khắc phục lỗi này bạn mở file wp-config.php & xóa dòng sau nếu tìm thấy:

define['WP_USE_EXT_MYSQL', true]; Tiếp đến, bạn truy cập quản trị Hosting cPanel, trong danh sách extensions của phiên bản PHP hiện tại bạn kích hoạt, hãy bỏ chọn mysqli & thay vào đó kích hoạt nd_mysqli.

Lỗi undefined mysql_connect[]

Để nhận được bài viết mới vui lòng đăng ký kênh kiến thức WordPress từ A-Z ở Form bên dưới. Bạn cũng có thể nhận được sự trợ giúp trên Twitter và Facebook

Còn không muốn cài lại thì tạo một file phpinfo[]. Rồi rồi search xem có hỗ trợ mysql không. nếu không hỗ trợ thì vào php.ini tìm xem có dòng nào như vầy không . Bỏ đi dấu khởi động lại là được

  • 3

Bạn xem xem MySQL có bất thường gì ko? Ví dụ như ko start dc ...etc....

  • 4

mình đã sữa được. Lý do là mình sử dụng hệ điều hành windows 7, mình cài vào phân vùng ổ C chắc có lẻ do tính bảo mật của HĐH này nên nó ngăn k cho load các thư viện lên, mình cài qua bên ổ đĩa khác thì ok

After you have closed the php tag["?>"]; meaning what comes after the closing php tag is not part of your php code. So try inserting the closing php tag at the end of your code. Something like this:


As for your code; I would simply rewrite it as:

    

Then try connecting to your MySQL database.

Chủ Đề