I am trying to populate a dropbox values by fetching data from mysql database using PHP. Here is the code I am trying to use
<?php
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("rumi", $con);
$resultList = mysql_query("SELECT item FROM items");
while ($row = mysql_fetch_array($resultList))
{
echo "<option value='" . $row['item'] . "'>" . $row['item'] . "</option>";
}
echo "</select>";
mysql_close($con);
?>
but I am encountering with following error: Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\wamp\www\Lst\index.php on line 22 can you lease let me know why this is happening? can you also let me know how i can list the items in am HTML Unordered list?