首 页 ASP ASP.NET PHP JSP Ajax DIV+CSS JavaScript XML C#
MySQL MSSQL Access Oracle Linux Server 电脑技巧 网络安全 建站经验 其它

如何用PHP和MySQL创建一个ShoutBox

整理日期:2008年08月10日 【字体:


伊图教程网[www.etoow.com]
http://www.etoow.com/html/2008-08/1218328747.html
# Simply Shouting - a shoutbox example
# File name: install.php
# Description: Creates the database table.

// include the database info file
include("mysql.inc.php");

//连接数据库

$connection = @mysql_connect($host, $user, $password) or die(mysql_error());
$db = @mysql_select_db($name,$connection) or die(mysql_error());

//如果我们已经有一个表名字叫做"shouts", 需要先删除它
$sql = 'DROP TABLE IF EXISTS `shouts`';
$result = @mysql_query($sql,$connection) or die(mysql_error());

// 现在确定没有相同名字的表, 创建它
$sql = 'CREATE TABLE `shouts` (
 `id` int(11) NOT NULL auto_increment,
 `timestamp` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
 `shoutby` varchar(50) default NULL,
 `shout` varchar(50) default NULL,
 PRIMARY KEY `id` (`id`)
) TYPE=MyISAM AUTO_INCREMENT=1' ;
echo 'Creating table: \'shouts\'....';
// 关闭连接
$result = @mysql_query($sql,$connection) or die(mysql_error()); ?>
<html>
<head>
<title>Simply Shouting - 安装</title>
</head>
<body>
<br />
你的安装过程已经完成. 请立即从你的服务器上删除所有安装文件. 本程序包含以下安装文件:<br />
<br />
1) install.php <br />
Tags:
如何用PHP和MySQL创建一个ShoutBox
'http://www.etoow.com/html/2008-08/1218328747.html
1
 
23
信息搜索
  
联系我们关于本站广告服务设为首页 收藏本站友情链接网站地图
Copyright © Etoow.com Inc. All Rights Reserved