i'm trying to populate a select list from a mysql database. my line numbers on the code are 90 to 104. the error i'm getting is

Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in C:\wamp\www\capstone\admin\admin_curriculum.php on line 99

my code is:

$con = mysqli_connect("localhost","root","");
$sql = "SELECT * FROM PROGRAM";
$result = mysqli_query($con, $sql);
if (!$con)
{
	die('Could not connect: ' . mysql_error());
}
else {
	mysqli_select_db($con, "IT_SOL_CTR");
	while($row = mysql_fetch_assoc($result))
	{
		echo "<option value=\"{$row['PROGRAM_ID']}\">
                          {$row['PROGRAM_ID']}</option>";
								  
	}
}

You're performing the query on line 3 but you don't select a database until line 9. You must select the db before you perform the query.

thanks, that got it working

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.