PHP query does not display data from sql table what to do?

connecting hph:
$db_host = localhost;
$db_user = doptvarh_root;
$db_password = Dop2tar1;
$db_name = doptvarh_bd123;


$link = mysql_connect($db_host, $db_user, $db_password, $db_name);
if (!$link) {
die(".mysql_connect_errno().' - '.mysql_connect_error().");
}

echo "You connected to MySQL!";
?>
the text of the query:
<?php
include("php/connect.php")
?>


 <meta charset="UTF-8">
 <link rel="stylesheet" type="text/css" href="css/stile1.css">
 <link rel="stylesheet" type="text/css" href="css/post.css">
 <title> </title>


the <div>
<?php
 $result= mysql_query("select * from test",$link);
 $row = mysql_fetch_array($result);
 if (mysql_num_rows($result)-->0)
{
 $row = mysql_fetch_array($result);
 die('<p style="color:red">'.$row["test1"].'</p>');
}
?>
</div>


the data table does not display the dB connection is
the name of the rows and the table name correct
tell me what the problem
June 27th 19 at 15:34
2 answers
June 27th 19 at 15:36
Solution
$db_host = "localhost" ;
$db_user = "doptvarh_root";
$db_password =" Dop2tar1";
$db_name = "doptvarh_bd123";
the connection worked, it did not help, the basic code output now:
<?php
 $result= mysql_query("select test1 from test",$link);
 while ( $row = mysql_fetch_array("$result"))
{
 echo 'some text'.$row['Test1'];}
 ?>

the text does not display - Morton.Cron commented on June 27th 19 at 15:39
:
$row = mysql_fetch_array($result) - quinton_Daugherty83 commented on June 27th 19 at 15:42
June 27th 19 at 15:38
Solution
Make var_dump of the result.
bool(false)
I will double-check the data - Morton.Cron commented on June 27th 19 at 15:41

Find more questions by tags PHP