query("SELECT * FROM article "); while ( $row = $stmt->fetch(PDO::FETCH_ASSOC) ) { if($row['public']=="public") { $tmparray=explode($_POST['search'],$row['content']); $tmparray2=explode($_POST['search'],$row['headline']); $count=count($tmparray)+count($tmparray2); if($count>2){ $result[]=array('content'=>$row['content'],'article_id'=>$row['article_id'],'headline'=>$row['headline'],'count'=>$count); } } } if(isset($result)) { $count = array(); foreach ($result as $res) { $count[] = $res['count']; } array_multisort($count, SORT_DESC, $result); } ?>
"); $article= substr($res['content'],0,300); echo(htmlentities($article)); echo("