万卷书   首页 > 电脑书籍 > PHP > 在线竞拍系统的PHP实现框架(二)
 
另外,我再给出添加新商品的方法吧。

<?php
include "config.inc.php";
include "tview.class.php";

function AddRecord(){
global $view;
//以下变量都是从上一个页面的表单中得到的。
global $name,$price,$unit,$year,$month,$day,$photofile,$intro;

$t=time();
$c=nl2br($intro);
$et=mktime(24,0,0,$month,$day,$year);

//判断一下是否有图上传了。
$ph=( $photofile!="none" and !empty($photofile) )? '1':'0';

//调用成员函数add()参数就是sql语句中的values()中的字串
$view->Add("'$t','$name','$c','$price','$unit','$et','0','$price','$ph'");

//如果有图片,拷到指定目录下。
if($ph=='1')
copy($photofile,"photo/$t.jpg");

}

if( $Submit){
$view= new TViewPage($WARE_TABLE,20);
AddRecord();
header("Location:manager.htm");
}

?>

   好了,罗罗嗦嗦写了两篇,不知道可不可以又加个几百分哦。:)

   有什么问题真心地请大家提出来讨论,我可是把程序拿出来了,您见到什么不妥的不当的,可千万不要吝啬,记得告诉我一声。

   我的email : ycshowtop@21cn.com

   另外,如果你想要这个程序比较完整的代码,也来个email,我寄给您。

上一页