我在 xampp 的 phpmyadmin 中创建了我的数据库“MUSIC”。我正在尝试使用我存储在 OML 文件夹中的 php 文件连接到该数据库,该文件又存在于 htdocs 文件夹中,我的代码是:
$db_name="MUSIC";
$db_user="root";
$db_pwd="ash123";
$db_host="localhost";
$connect = mysql_connect("localhost","root","ash123");
mysql_select_db("MUSIC");
echo "connection successful";
但是当我转到 localhost 并键入 localhost/connect.php
时,我收到此错误:
Object not found!
the requested URL was not found on this server.if u entered the URL manually please check your spelling and try again.If you think this is a server error,please contact webmaster.
Error 404
localhost
Apache/2.4.3 (Unix) OpenSSL/1.0.1c PHP/5.4.7
我已经搜索过了,但是我找到了解决这个问题的方法,请帮忙!
最佳答案
i am trying to connect to this database using a php file which i have stored in the OML folder which in turn is present in the htdocs folder
那么,URI 应该是 /OML/connect.php
而不是 /connect.php
,对吧?
关于php - "object not found"使用 php 连接到 mysql 数据库时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12994445/