"; $html = file_get_contents("article_templ.htm"); $title_block = "
Finrise`s business articles directory.
$google
"; $list_block = "
"; $dbarticles=MYSQL_CONNECT($hostname,$username,$password) OR DIE("could not create coonect "); mysql_select_db("$username",$dbarticles) or die("
could not select db "); $query = "Select * from $table where state = 'st_approved'"; $result = MYSQL_QUERY($query); echo mysql_error(). "\n"; $list_arr = array('Forex, currency trading' =>array(), 'Personal Finance' =>array(), 'Mortgage, Real Property' =>array(), 'Money building' =>array(), 'Loan' =>array(), 'Investing' =>array(), 'Insurance' =>array(), 'Credit' =>array(), 'Stock,Mutual Fund' =>array()); while ($myrow = mysql_fetch_array($result)) { $art_item = array(); $art_item['author'] = $myrow['Author']; $theme = $myrow['Theme']; $art_item['title'] = $myrow['Title']; $art_item['description'] = $myrow['Description']; $art_item['date'] = $myrow['date']; $art_item['id'] = $myrow['IdArticle']; $list_arr[$theme][] = $art_item; } $item_place =""; foreach($list_arr as $theme=>$la) { $cnt = count($la); $list_item = "
$theme
($cnt)
"; if ($la != 0) { foreach ($la as $item) { $title = $item['title']; $id = $item['id']; $title = "
$title
"; $description = $item['description']; $art_text = "
$title
$description
"; $list_item = $list_item.$art_text; } } $item_place = $item_place.$list_item; } $list_block = str_replace("
",$item_place,$list_block); $text_block = $title_block.$list_block; $html=str_replace("
",$text_block,$html); echo $html; ?>