Get this from error-message invalid query: No database selected, even though I have selected database in my template.php
This is the code im making right now. It's a table that displays users for the admin: anvandare.php:
$query = "select * from user";
$run = mysql_query($query);
if (!$run){
die('invalid query: ' . mysql_error());
}
while($row=mysql_fetch_array($run)){
$email = $row['email'];
$company = $row['company'];
$fname = $row['fname'];
$licensID = $row['licensID'];
$tel = $row['tel'];
?>
<td><?php echo $email; ?></td>
<td><?php echo $company; ?></td>
<td><?php echo $fname; ?></td>
<td><?php echo $licensID; ?></td>
<td><?php echo $tel; ?></td>
<td> ta bort </td>
</tr>
<?php } ?>
</table>
</div> <!-- Stänger jumbotron -->
</div> <!-- Stänger jumbotronbekraftat -->
</div> <!-- Stänger container -->
<?php
echo $navigation_admin;
echo $header;
?>
This is the databas.php
<?php
session_start();
session_regenerate_id();
$mysqli = new mysqli("localhost", "root", "", "Webbprojekt");
mysqli_set_charset($mysqli,"utf-8");
?>
How do I sort this problem out? Because in the include (template.php)
I have connected with my database.