我正在尝试在托管网站 www.my3gb.com 中托管我的代码 我的代码在我的电脑上运行良好,但当我在那里托管时却无法运行......看看这段代码......
<html>
<body bgcolor="green">
<?php
$conn=mysql_connect("http://www.my3gb.com/phpmyadmin/","username","password");
mysql_select_db("mohit007kumar00_cboy",$conn);
print "<h1>connected</h1>";
$rs=mysql_query("select * from signup where user='".$_POST['t1']."'");
print "<h1>queried</h1>";
while($row=mysql_fetch_array($rs))
{
print "<h1>under while</h1>";
if($row['pswd']==$_POST['t2'])
{
print "<h1>You are alowed</h1>";
}
else
{
print "<h1>not alowed</h1>";
}
}
?>
</body>
</html>
登录页面是......
<html>
<body bgcolor="yellow">
<center>
<h1>Login Application</h1>
<form action="log.php" method="post">
user<input type="text" name="t1"><br><br>
pswd<input type="password" name="t2"><br><br>
<input type="submit">
</form>
</center>
</body>
</html>
在我的电脑上它会显示这样的输出...... 连接的 询问 一会儿 你被允许 在我的托管链接上,它将显示这样的输出...... 连接的 询问 您可以在这里查看我的登录页面 http://mohit007kumar00.my3gb.com/test.php
最佳答案
我认为问题出在这里:
mysql_connect("http://www.my3gb.com/phpmyadmin/","username","password");
尝试
mysql_connect("localhost","username","password");
我认为 MySQL 不会连接到托管的 phpMyAdmin,但也许这是我的误解。
关于php - 无法使用我的托管登录页面登录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5458637/