Ophp_network_getaddresses: getaddrinfo failed: name or service not known

Hi, I’m trying to create a user on my login PHP page, but it gives me the following error:errophp_network_getaddresses: getaddrinfo failed: name or service not known.
Does anyone know what is wrong? My website:
http://nicholaslogin.lovestoblog.com/

Can you let me know what script you are using? If you self-coded, can you share your code?
Thanks

All files available: GitHub - Nicholasmais/register
I created a user using control panel phpmyadmin, but when I use the same values on login page it gives the same error.
The code:

<?php

  session_start();

  $link = mysqli_connect("localhost","root","","login");

        

   if ($link === false){

       die(" <br>ERRO".mysqli_connect_error());

   }

   $user = mysqli_real_escape_string($link,$_POST['usuario']);

   $_SESSION['user'] = $user;

   

   $pass = (mysqli_real_escape_string($link,$_POST['pass']));

   $query = $link->prepare("select * from cadastro where usuario = ?");

   $query -> bind_param("s",$user);

   $query ->execute();

   $result=  $query->get_result();

   $row1 = mysqli_fetch_array($result);

   if (mysqli_num_rows($result)>0 && password_verify($pass,$row1["senha"])){

    header("Location:conta.php"); 

    exit;

    }

   

   else{

     echo "Usuário ou senha inválidos! ";

   }

    mysqli_close($link);

  ?>

This is likely your error

image

Replace with actual database, user and password

1 Like

I did it. Im having troubles replying. It gives me error 403.

The issue is caused by the various whitespace characters in the hostname field. It should just be sql310.epizy.com. You put the end quote for the hostname field on the line below, which changes the content of the hostname field.

4 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.