prepare('SELECT category,public FROM article WHERE user_id = :user_id');
$stmt->execute(array( ':user_id' => $_GET["user_id"]));
$row = $stmt->fetch(PDO::FETCH_ASSOC);
if ( $row == false ) {
$flag=0;
}
else{
$flag=1;
if(isset($_SESSION['user_id'])&&$_SESSION['user_id']==$_GET['user_id'])
{
while ( $row = $stmt->fetch(PDO::FETCH_ASSOC) ) {
if($row['category']!=null)
{
$category[]=$row['category'];
}
}
}
else{
while ( $row = $stmt->fetch(PDO::FETCH_ASSOC) ) {
if($row['category']!=null&&$row['public']=="public")
{
$category[]=$row['category'];
}
}
}
$category=array_unique($category);
}
?>