function show($id){
// query the articlestosites table to find sites that have been assigned the particular article
$query1 = "SELECT * FROM articlestosites where articleid = '{$id}'";
$q1 = mysql_query($query1);
while($row1 = mysql_fetch_assoc($q1)) {
$newIDarray[]=$row1['siteid'];
}
$result = mysql_query("SELECT * FROM sitedetails");
while($row = mysql_fetch_array($result)) {
$idd = $row['id'];
if(!is_array($newIDarray)) { $newIDarray[] = ""; }
if(in_array($idd,$newIDarray)) {
echo "<input CHECKED type=checkbox name=site[] value=".$idd.">". $row["site"];
}else{
echo "<input type=checkbox name=site[] value=".$idd.">". $row["site"];
}
// do my business with the select box for articletype
echo "<select name=type{$idd}>";
$result2 = mysql_query("SELECT * FROM articletypes");
while($row2 = mysql_fetch_array($result2)) {
if (**DON"T KNOW WHAT TO PUT HERE**) {
echo "<option SELECTED>{$row2["articletype"]}</option>";
} else {
echo "<option>{$row2["articletype"]}</option>";
}
}
echo "</select><br>\n\r";
}
} |