I have the following php code:
<?php
$con=mysqli_connect("server19.0hosting.org","user","password","dbname");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$result = mysqli_query($con,"SELECT * FROM dbtable");
echo "<table border='1'>
<tr>
<th>Nume</th>
<th>Teme facute</th>
<th>Teme nefacute</th>
</tr>";
while($row = mysqli_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['Nume'] . "</td>";
echo "<td>" . $row['Teme facute'] . "</td>";
echo "<td>" . $row['Teme nefacute'] . "</td>";
echo "</tr>";
}
echo "</table>";
mysqli_close($con);
?>
When I run it online, I get the following message:
Warning: mysqli_connect(): (28000/1045): Access denied for user 'u536268762_alex'@'srv19.main-hosting.com' (using password: YES) in /home/u536268762/public_html/index.html on line 2 Failed to connect to MySQL: Access denied for user 'u536268762_alex'@'srv19.main-hosting.com' (using password: YES)
Warning: mysqli_query() expects parameter 1 to be mysqli, boolean given in /home/u536268762/public_html/index.html on line 9
Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, null given in /home/u536268762/public_html/index.html on line 18
Warning: mysqli_close() expects parameter 1 to be mysqli, boolean given in /home/u536268762/public_html/index.html on line 28
Can please anyone help me? Also, is it the right hostname the one I wrote there before user?