我已经尝试了我能想到的一切......从我的本地主机到另一个服务器主机(它也使用本地主机,因为我显然在他们的服务器上使用 ftp),但我仍然不断收到错误:警告:mysqli::mysqli( ) [mysqli.mysqli]: (28000/1045): 在 /www/zxq.net/a/p/p/( censored)/htdocs/lib.php on line 6 Connect failed: Access denied for user '(censored)_zxq'@'192.168.1.1' (使用密码: YES)
我也尝试了多个支持 mysql 的主机...我不断收到该错误,我知道我的凭据是正确的。并且我已经向用户授予了数据库的权限。有什么建议么?(ps.我审查了重要信息给我)
<?php
$server = 'localhost';
$login = '792981_kputts';
$password = 'whatup4u';
$database = '(censored)_zxq_ireport';
//access
$connection = new mysqli($server, $login, $password, $database);
//executes a given sql query with the params and returns an array as result
function query() {
global $link;
$debug = false;
//get the sql query
$args = func_get_args();
$sql = array_shift($args);
//secure the input
for ($i=0;$i<count($args);$i++) {
$args[$i] = urldecode($args[$i]);
$args[$i] = mysqli_real_escape_string($link, $args[$i]);
}
//build the final query
$sql = vsprintf($sql, $args);
if ($debug) print $sql;
//execute and fetch the results
$result = mysqli_query($link, $sql);
if (mysqli_errno($link)==0 && $result) {
$rows = array();
if ($result!==true)
while ($d = mysqli_fetch_assoc($result)) {
array_push($rows,$d);
}
//return json
return array('result'=>$rows);
} else {
//error
return array('error'=>'Database error');
}
}
//loads up the source image, resizes it and saves with -thumb in the file name
function thumb($srcFile, $sideInPx) {
$image = imagecreatefromjpeg($srcFile);
$width = imagesx($image);
$height = imagesy($image);
$thumb = imagecreatetruecolor($sideInPx, $sideInPx);
imagecopyresized($thumb,$image,0,0,0,0,$sideInPx,$sideInPx,$width,$height);
imagejpeg($thumb, str_replace(".jpg","-thumb.jpg",$srcFile), 85);
imagedestroy($thumb);
imagedestroy($image);
}
?>