All articles| All Pictures| All Softwares| All Video| Go home page| Write articles| Upload pictures

Reading number is top 10 articles
PHP脚本的8个技巧(8)PHP和XML_[PHP教程]
asp.net,2.0,权限树的控制_.net资料_编程技术
WML学习(六):事件_[XML教程]
使用FileUpload控件上传图片并自动生成缩略图、自动生成带文字和图片的水印图_[Asp.Net教程]
PHP生成静态HTML文章发布系统的思路_php资料_编程技术
浅谈水晶报表在ASP.NET中的一种灵活应用_[Asp.Net教程]
ASP.NET实现自动返回上次请求页面小技巧_[Asp.Net教程]
在asp.net页面中使用异步读取_.net资料_编程技术
C#中创建用户控件应用实例
PHP一生成柱状图、横柱图、折线图的类_[PHP教程]
Reading number is top 10 pictures
Most cow mistress ZhaoGongXia face exposure
Terrorist smile the largest human history an explosion2
girl of HuNan name is LiXiang(湖南辣姐李湘的写真)
Black and white also sexy--YanLiu2
The dog buy the ham oneself
中国的十元人民币的秘密
Forced sex girl living abroad2
避免防盗门的猫眼变成钥匙眼
2012 national geographic daily picture8
In the world the most mysterious 21 place landscape2
Download software ranking
好色的外科大夫
传奇私服架设教程-chm
Sora aoi, the nurse, uniform ,nursing assistant
The hero
1400篇各类破解文章
Sora aoi's film--cangkong_Blue.Sky
WebService在.NET中的实战应用教学视频 → 第4集
在线棋牌游戏3.05版
jdk1.6 for windows
电车之狼R
";
$db=connect_db();
$db_name=db_name();
mysql_select_db($db_name,$db);
if ($show_news_sub)
{
$show_news = $show_news_sub;
}
if (!ereg("([0-9]{".strlen($show_news)."})",$show_news))
{
$show_news="ALL";
}
if (strtoupper($show_news)=="ALL")
{
$sql="select date_format(n_date,'%m/%d/%Y') as n_date, date_format(n_date,'%H:%i') as n_time ,news , n_date as date from news order by date desc";
}
else
{
$link="All news";
$sql="select date_format(n_date,'%m/%d/%Y') as n_date, date_format(n_date,'%H:%i') as n_time , news , n_date as date from news order by n_date desc limit $show_news";
}
$result=mysql_query($sql,$db);
$num_rows=mysql_num_rows($result);
if($num_rows!=0)
{
echo " ";
while($myrow=mysql_fetch_array($result))
{
$date=$myrow["n_date"];
$time=$myrow["n_time"];
$news=$myrow["news"];
$n_id=$myrow["n_id"];
if (strtoupper($show_date)=="Y" && strtoupper($show_time)=="Y")
{
$show=$date." ".$time;
}
else if (strtoupper($show_date)=="Y" && strtoupper($show_time)!="Y")
{
$show=$date;
}
if (strtoupper($show_date)!="Y" && strtoupper($show_time)=="Y")
{
$show=$time;
}
$cleannews=(nl2br($news));
aaa published in(发表于) 2013/12/24 5:50:39 Edit(编辑)
PHP技巧:分析利用PHP制作新闻系统的步骤_php资料_编程技术

PHP技巧:分析利用PHP制作新闻系统的步骤_php资料_编程技术

PHP技巧:分析利用PHP制作新闻系统的步骤_php资料_编程技术-你的首页-uuhomepage.com

我们可以用新闻系统来存储新闻,我们可以对新闻进行添加、删除等操作,这样减少了大家的工作量,为什么不实验一下。

首先,建立一个表。

create table news (
n_id int(255) not null auto_increment,
n_date datetime not null,
news text not null,
primary key(n_id)
);

第二步,设置你的登陆信息

$database_user_name="root";
$database_password="";
$database_name="news";
$time_offset="0";

第三步,让我们把后面程序用到的东西作成函数,节省篇幅啊!

function connect_db()
{
// connects to the database
global $database_user_name, $database_password;
$db=mysql_connect("localhost",$database_user_name,$database_password);
return $db;
}
function db_name()
{
// returns the name of the database
global $database_name;
$db_name=$database_name;
return $db_name;
}
function get_now()
{
// gets current date and time
$db=connect_db();
$db_name=db_name();
mysql_select_db($db_name,$db);
$sql="select now() as now";
$result=mysql_query($sql,$db);
$myrow=mysql_fetch_array($result);
$now=$myrow["now"];
return $now;
}

第四步,让我们考虑如何将新闻显示出来

//上面已经定义的函数库...
//表格的定义......

$title ";
if ($admin==1)
{
echo " Admin ";
}
echo " - News
$show
$cleannews
";
}
echo " ";
}
if ($admin==1)
{
echo "
返回
";
}
if ($link)
{
echo "


$link
";
}





添加到del.icio.us 添加到新浪ViVi 添加到百度搜藏 添加到POCO网摘 添加到天天网摘365Key 添加到和讯网摘 添加到天极网摘 添加到黑米书签 添加到QQ书签 添加到雅虎收藏 添加到奇客发现 diigo it 添加到饭否 添加到飞豆订阅 添加到抓虾收藏 添加到鲜果订阅 digg it 貼到funP 添加到有道阅读 Live Favorites 添加到Newsvine 打印本页 用Email发送本页 在Facebook上分享


Disclaimer Privacy Policy About us Site Map

If you have any requirements, please contact webmaster。(如果有什么要求,请联系站长)
Copyright ©2011-
uuhomepage.com, Inc. All rights reserved.