As all have commented I have changed my code. Now the thing is when I am running my below php code as separate file its running like charm:
<?php
require("phpsqlajax_dbinfo.php");
$conn = new mysqli($hostname, $username, $password, $database);
$sql = "SELECT username FROM users";
$result = mysql_query($sql);
echo "<select name='username'>";
while ($row = mysql_fetch_array($result)) {
echo "<option value='" . $row['username'] . "'>" . $row['username'] . "</option>";
}
echo "</select>";
?>
But when I am trying to include this into html code its not working:
<!DOCTYPE html>
<html>
<head>
<title>FusionCharts Column 2D Sample</title>
</head>
<body>
<div>
<?php
require("phpsqlajax_dbinfo.php");
$conn = new mysqli($hostname, $username, $password, $database);
$sql = "SELECT username FROM users";
$result = mysql_query($sql);
echo "<select name='username'>";
while ($row = mysql_fetch_array($result)) {
echo "<option value='" . $row['username'] . "'>" . $row['username'] . "</option>";
}
echo "</select>";
?>
</div>
<div id="chart-container">LOADING....</div>
<script src="js/jquery-2.2.4.js"></script>
<script src="js/fusioncharts.js"></script>
<script src="js/fusioncharts.charts.js"></script>
<script src="js/themes/fusioncharts.theme.zune.js"></script>
<script src="js/userChart.js"></script>
</body>
</html>


new mysqli...->mysql_query(...). Not the same. How are you not getting errors? And stop usingmysql_*they've been deprecated for such a long time it's not even funny anymore.mysql_database extension in new code a Kitten is strangled somewhere in the world it is deprecated and has been for years and is gone for ever in PHP7. If you are just learning PHP, spend your energies learning thePDOormysqlidatabase extensions. Start heremysql_*!