I want to create a table with PHP, but it won't work... Here is my code:
<!DOCTYPE html>
<html>
<head>
<title>Table with PHP</title>
</head>
<body>
<?php
$dblink=mysqli_connect('IP','username','password');
if (mysqli_connect_errno())
{
echo "Error: Failed to connect to MySQL: " . mysqli_connect_error();
}
mysqli_select_db($dblink,'database');
$abfrage='$dblink,"SELECT * FROM database"';
$ergebnis='mysqli_query($abfrage)';
?>
<table width="1000" cellpadding="0" cellspacing="0" border="0">
<tr>
<th>var1</th>
<th>var2</th>
<th>var3</th>
</tr>
The error is somewhere here
<?php
while($row='mysqli_fetch_object($ergebnis)'){
echo '<tr>'."\r\n";
echo '<td>'.$row->var1.'</td>'."\r\n";
echo '<td>'.$row->var2.'</td>'."\r\n";
echo '<td>'.$row->var3.'</td>'."\r\n";
echo '<tr>'."\r\n";
}
?>
</body>
</html>
The errors are:
Notice: Trying to get property 'var1' of non-object in (Path) on line xx
Notice: Trying to get property 'var2' of non-object in (Path) on line xx
Notice: Trying to get property 'var3' of non-object in (Path) on line xx