<?php
function getMysqlConnection($host,$user,$pass,$database){
global $mysqli;
global $Mysqlerror;
$mysqli = new mysqli('$host','$user','$pass','$database');
if(empty($mysqli->connect_errorno) == false){
$Mysqlerror = "true";
}else{
$Mysqlerror = "false";
} }
?>
Tôi đã tạo ra một chức năng như trên mà thực hiện kết nối trên cho mysql thông tin người dùng và tôi thực hiện chức năng này bằng cách sử dụngMysql lỗi liên
<?php
require 'myFunc.php';
getMysqlConnection("localhost", "wronguser","wrongpass" ," test");
echo $Mysqlerror;
?>
Mặc dù tôi sử dụng mật khẩu sai và username các Mysqlerror là sai . Tôi cũng sử dụng hoặc chết chức năng không có gì xảy ra
Warning: mysqli::mysqli(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /opt/lampp/htdocs/mysite/myFunc.php on line 5
Warning: mysqli::mysqli(): (HY000/2002): php_network_getaddresses: getaddrinfo failed: Name or service not known in /opt/lampp/htdocs/mysite/myFunc.php on line 5
tôi khởi động lại lampp như thường lệ nó cho thấy
Starting XAMPP for Linux 1.8.0...
XAMPP: Starting Apache with SSL (and PHP5)...
XAMPP: Starting MySQL...
Warning: World-writable config file '/opt/lampp/etc/my.cnf' is ignored
XAMPP: Starting ProFTPD...
/opt/lampp/share/lampp/alladdons: line 23: /opt/lampp/share/addons/: is a directory
XAMPP for Linux started.
Là vấn đề với mã của tôi hoặc với máy chủ của tôi một số điều. Làm thế nào để sửa chữa nó?
xin lỗi vì lỗi vô tình đó – gokul