所以我已经写了一些代码通过PHPmyadmin连接到sql数据库,现在当我在本地主机(xampp)上使用它但将代码放到网上(托管one.com)并更改所有pdo信息时,此方法有效关于one.com中的数据库。它不断否认acces,我似乎找不到为什么。
使用mysqli连接
<?php
$db = "";
error_reporting(E_ALL);
ini_set("display_errors",1);
$paginaData = new stdClass();
$paginaData->titel = "Ledenlijst";
$paginaData->content = include_once "views/navigatie.php";
//database
$dbInfo = "mysql:21=ftp.*****.be;dbname=******";
$dbUser = "******";
$dbPassword = "*******";
try{
$db = new PDO($dbInfo,$dbUser,$dbPassword);
$paginaData->content .= "connection to database established";
} catch(Exception $e) {
$paginaData->content .= $e;
}
if(isset($_GET["page"])) {
$fileToLoad = $_GET["page"];
$paginaData->content .= include_once "controller/$fileToLoad.php";
} else {
$paginaData->content .= "did not GET page";
}
$pagina = include_once "pagina.php";
echo $pagina;
PDOException:SQLSTATE [HY000] [1045] /中的用户'*******。be'@'10. 。 .24'(使用密码:是)的访问被拒绝。 customer / 0/6/4 / sikambers.be / httpd.www / start.php:20堆栈跟踪:#0 /customers/0/6/4/sikambers.be/httpd.www/start.php(20): PDO-> __ construct('mysql:21 = 46.30 ....','********。be','*****')#1 {main}未获取页面