gpt4 book ai didi

php - 无法使用 php 读取或写入数据库

转载 作者:行者123 更新时间:2023-11-30 01:08:31 26 4
gpt4 key购买 nike

我正在开发一个网站,因此我将数据存储在 db4free.net -免费在线数据库 - 中,但我无法读取或写入,甚至无法选择数据库(错误:查询错误:.SELECT 命令被拒绝给用户''@'localhost' for table 'first')但我尝试了 heidiSQL - 桌面应用程序通过网络管理数据库 - 它工作正常,我可以选择、插入和删除。这是我的 php 代码:

$conn=mysqli_connect("db4free.net:3306","usr","pass");
$sql = "select * from test1.first";
$result = mysql_query($sql) or die ("Error in query: $query. ".mysql_error());

请问有什么帮助吗?

最佳答案

这对我有用:

$conn=mysql_connect("db4free.net","usr","pass",3306);

关于php - 无法使用 php 读取或写入数据库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19613302/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com