php - "object not found"使用 php 连接到 mysql 数据库时

标签 php mysql database phpmyadmin

我在 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/

相关文章:

php - 找不到类 'Google\Cloud\Storage\StorageClient'

php - 如何在 PDO 中获取数据库名称?

mysql - 这些查询有什么区别?

javascript - 使用 javascript 更改 iframe 中的链接

javascript - 将 PHP JSON 字符串转换为有效的 json

php - 如何在 MAMP 中访问 PDO?

MYSQL:将值列表连接到表中

mysql - org.springframework.dao.InvalidDataAccessResourceUsageException : could not extract ResultSet;

mysql - Symfony 连接同一个表以从表中获取值作为别名

php - Codeigniter 在没有 num_rows() 的情况下处理数据库错误