$conn = mysql_connect("localhost", "username", "password");
$db = mysql_select_db("ddm");
// running sql query table = category, attributes = categoryID, cate
$list = mysql_query("SELECT * FROM category", $conn); //change here
while ($row = @mysql_fetch_assoc($list))
{ //option value everything is here, query as much as data from database
echo "<option value=\"$row[categoryID]\">$row[cate]</option>\n<br>";
}
if ($_POST['categoryID'] !=" ")
{
$conn = mysql_connect("localhost", "username", "password");// delete this line
$db = mysql_select_db("ddm"); // delete this line
$list2 = mysql_query("SELECT * FROM category2 where categoryID=$categoryID", $conn);//change
while ($row2 = @mysql_fetch_assoc($list2))
{
echo "<option value=\"$row2[categoryID]\">$row[cate2]</option>\n<br>";
}
}
Try that and see if it works ... I made comments near the lines to delete also put comment next to lines I changed
GL