setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$db->exec('SET NAMES utf8');
} catch(PDOException $e) {
die('Connection failed: '.$e->getMessage());
}
$sth = $db->prepare("SELECT COUNT(*) from classnews where jyoutai = '公開'");
$sth->execute();
// news記事数を変数に代入
while ($row = $sth->fetch(PDO::FETCH_ASSOC)) {
$newscount = $row['COUNT(*)'];
echo '';
echo "現在{$newscount}件のニュースがあります。";}
echo ' |
';
?>
setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$db->exec('SET NAMES utf8');
} catch(PDOException $e) {
die('Connection failed: '.$e->getMessage());
}
// 画像テーブルのデータを取得します
$sth = $db->prepare("SELECT * FROM classnews where jyoutai = '公開'");
$sth->execute();
?>
fetch(PDO::FETCH_ASSOC)) {
echo ' |
';
echo '';
echo ''.$row['when_y'].'年'.$row['when_m'].'月'.$row['when_d'].'日 ';
echo ''.$row['title'].'';
$sakuhinimage = $row['sakuhinimage'];
if(0 < $sakuhinimage OR $sakuhinimage != NULL){echo ' '; }
echo " ";
echo ' |
';
}
?>