作者:祢好世界末日 | 来源:互联网 | 2023-05-18 09:31
JustinstalledMAMPandamlearningaboutphpandconnectingtomydatabases.Iseemtobeabletoc
Just installed MAMP and am learning about php and connecting to my databases. I seem to be able to connect to mysql but can't connect or see any databases in phpMyAdmin.
刚刚安装了MAMP,正在学习php和连接到我的数据库。我似乎可以连接到mysql,但不能连接或看到phpMyAdmin中的任何数据库。
Here's my php code:
这是我的php代码:
connect_error) {
die('Connect Error (' . $mysqli->connect_errno . ') '
. $mysqli->connect_error);
}
$db_selected = mysqli_select_db($db, $link);
if (!$db_selected) {
echo "did not connect";
}
?>
When I run it, I'll get the words "good", so I know I'm connecting, followed by "did not connect", so it's not connecting to my database.
当我运行它时,我将会得到“good”,所以我知道我正在连接,接着是“没有连接”,所以它没有连接到我的数据库。
I've also tried adding this code and nothing gets echoed at all even though I have several databases created.
我也尝试过添加这段代码,即使我创建了几个数据库,也没有得到任何响应。
$res = mysqli_query("SHOW DATABASES");
while ($row = mysqli_fetch_assoc($res)) {
echo $row['Database'] . "\n";
}
Any help is appreciated!
任何帮助都是赞赏!
1 个解决方案