6月10
“人懒有天收”。。。偶都有点不好意思了,PHP从07年就上手看与捣鼓了,今天还在看些初级的CURD,惭愧,也许你早就进入.NET的殿堂,座拥电子商务行业的B2C程序了,这是前话,上个星期去淘书,于是就有了现在的这本《PHP+MYSQL八大动态应用实战》,正拿手上呢,半斤八两,在新华书店瞅的时候觉得这个书不错的说,老美JONO BACON的话诙谐幽默,确如书中前言所说实战,步步为营,引人入胜,偶也跟着抄写代码来学,不过看过两天发现,除了CURD的数据库操作就只剩下错别字了,多到令人难以忍受的地步,阿门,调试程序让我大大吐血,菜鸟怎么不疯狂,没有MVC,没有足够的AJAX,不够主流的W3C,一些缺点让人郁闷,……

看看下面的程序吧,帮你清空下肠胃
<?php
require ("config.php");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php echo"欢迎访问".$config_blogname;?></title>
<link href="styles.css" rel="stylesheet" type="text/css" />
</head>
<body class="oneColFixCtrHdr">
<div id="container">
<div id="header">
<h1>
<?php require("header.php"); ?>
</h1>
</div>
<div id="mainContent">
<?php
require ("config.php");
$sql="SELECT entries.*, catetories.cat FROM entries, catetories
where entries.cat_id=catetories.id
ORDER BY dateposted desc
LIMIT 1";
$result=mysql_query($sql);
$row=mysql_fetch_assoc($result);
?>
<h1><?php echo $row['subject'];?> </h1>
<?php echo '分类:'.$row['cat'].' 序号:'.$row['id'].' 时间:'.date("D js f y g.iA",strtotime($row['dateposted'])); ?>
<p><?php echo $row['body']; ?></p>
<h2>H2 级别的标题 </h2>
</div>
<div id="footer">
<p>
<!--评论开始-->
<?php
require ("config.php");
$commsql="select name from comments where blog_id=".$row['id']."order by dateposted";
$commresult=mysql_query($commsql);
$numrows_comm=mysql_num_rows($commresult);
?>
<?php
if ($numrows_comm==0){
echo "<p>no comments.</p>";
}
else {
echo "$numrows-comm.'个评论'";
$i=1;
while($commrow=mysql_fetch_assoc($commresult)){
echo "<a href='viewentry.php?id=".$row['id']."#comment".$i."'>".$commrow['name']."</a>";
$i++;
}
}
echo "</p>";
?>
<?php require("footer.php"); ?>
</p>
</div>
</div>
</body>
</html>
看看下面的程序吧,帮你清空下肠胃
<?php
require ("config.php");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php echo"欢迎访问".$config_blogname;?></title>
<link href="styles.css" rel="stylesheet" type="text/css" />
</head>
<body class="oneColFixCtrHdr">
<div id="container">
<div id="header">
<h1>
<?php require("header.php"); ?>
</h1>
</div>
<div id="mainContent">
<?php
require ("config.php");
$sql="SELECT entries.*, catetories.cat FROM entries, catetories
where entries.cat_id=catetories.id
ORDER BY dateposted desc
LIMIT 1";
$result=mysql_query($sql);
$row=mysql_fetch_assoc($result);
?>
<h1><?php echo $row['subject'];?> </h1>
<?php echo '分类:'.$row['cat'].' 序号:'.$row['id'].' 时间:'.date("D js f y g.iA",strtotime($row['dateposted'])); ?>
<p><?php echo $row['body']; ?></p>
<h2>H2 级别的标题 </h2>
</div>
<div id="footer">
<p>
<!--评论开始-->
<?php
require ("config.php");
$commsql="select name from comments where blog_id=".$row['id']."order by dateposted";
$commresult=mysql_query($commsql);
$numrows_comm=mysql_num_rows($commresult);
?>
<?php
if ($numrows_comm==0){
echo "<p>no comments.</p>";
}
else {
echo "$numrows-comm.'个评论'";
$i=1;
while($commrow=mysql_fetch_assoc($commresult)){
echo "<a href='viewentry.php?id=".$row['id']."#comment".$i."'>".$commrow['name']."</a>";
$i++;
}
}
echo "</p>";
?>
<?php require("footer.php"); ?>
</p>
</div>
</div>
</body>
</html>

教你学会开心
你是自然界最伟大的奇迹--自勉篇





