I have the following code in my file. It reurns nothing but blank.. when I check error log file I see this:
PHP Warning: mysqli_fetch_assoc() expects parameter 1 to be mysqli_result, boolean given in
.
<?php
include "dbfilepath";
$con = mysqli_connect($server, $db_user, $db_pwd, $db_name);
$username = $_SESSION['username'];
$sql = "SELECT FROM users WHERE username='$username'";
$data = mysqli_query($con, $sql);
$row = mysqli_fetch_assoc($data);
?>
why is that? for me it looks all fine..
and how to secure this simple code from sql injections?