M
M
marq2021-12-02 10:06:21
PHP
marq, 2021-12-02 10:06:21

Why is the hosting request not working?

Good afternoon, there is a regular select request, everything is fine on the local server, but nothing comes from the hosting database

$const = mysqli_connect('176.126.165.65', 'test' ,'test')  or die ("html>script language='JavaScript'>alert('Не удается подключиться к базе данных. Повторите попытку позже.'),history.go(-1)/script>/html>") ;
  mysqli_select_db( $const, "zaiavka" );

$sql = "SELECT * FROM test";
$result = $const->query($sql);

if ($result->num_rows > 0) {
   
    while($row = $result->fetch_assoc()) {
       $orders[]=$row;

    }
} else {
   echo "error";
}

$const->close();

gives an error

Answer the question

In order to leave comments, you need to log in

2 answer(s)
L
Lukin Danil, 2021-12-02
@ld161100

Try using localhost instead of IP

M
marq, 2021-12-02
@marq

Many thanks to everyone, I messed up myself, I indicated the wrong base)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question