代码之家  ›  专栏  ›  技术社区  ›  Sagar Parikh

php文件在live服务器上显示错误

  •  0
  • Sagar Parikh  · 技术社区  · 6 年前

    我试图上传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>
    
    1 回复  |  直到 6 年前
        1
  •  0
  •   L1R    6 年前

    错误报告(e_u error_u parse);

    把它放在php的顶部,它将停止显示错误消息。这无法修复您的错误。但听起来你只是想好好展示一下。