我试图上传php文件与我的网站从表单中获取数据,它运行完美,但它显示错误时,它的生活。
错误是:
警告:mysqli_connect():(hy000/1044):用户“ideamak1_sagar”@“%”拒绝访问/home/ideamak1/public_html/afterform.php中第12行的数据库“ideamak1_data”
错误:无法连接GH。
这是我的php代码
<!DOCTYPE html>
<head>
</head>
<body>
<?php
$name = $_POST['name'];
$email = $_POST['email'];
$contact = $_POST['contact'];
$comment = $_POST['comment'];
$link = mysqli_connect("localhost",
"ideamak1_sagar", "Jmtm,?j4T(ZD",
"ideamak1_data") or die("ERROR: Could
not connect gh. ");
if(isset($_POST['name']) &&
isset($_POST['email'])){
$sql = "INSERT INTO user (name, email,
contact, comment) VALUES ('$name',
'$email', '$contact', '$comment')";
$result = mysqli_query($link, $sql) or
die("ERROR: Could not connect. ");
mysqli_close($link);
?>
<h1>Thank You for Contacting Us <?php
echo "<span
style='color:purple;'>$name</span>" ?>
</h1>
<h3>We will be contacting you
soon</h3> <a href="index.html">Click
here for redirecting site..</a
<?php
}else{
?> <p>Your account have been not
registered yet.</p>
<a href="index.html">Click here
for redirecting site..</a>
<?php }?>
</body>
</html>