I'm trying to retrieve the results of users in my database, and then if my checkbox is selected to retrieve only users who have photos to show those results, but I can't seem to figure out how to loop through those results or if I am even doing it in the right context. `
$photos = $_POST['pcbox'];
$basicsql = "SELECT * FROM users";
$basicsql .= "WHERE status > '1'";
if($photos=='1'){
$sql = mysql_query("SELECT user_id FROM pictures GROUP BY user_id");
while($row2 = mysql_fetch_assoc($sql))
$options[] = " AND (users.user_id = '$row2[user_id]')";
foreach($options as $key => $str){
$basicsql .= $str;
}
}
$basicsql .= " ORDER BY users.last_login DESC";
$pagesql = mysql_query($basicsql);
All works until the checkbox is selected