sql语句(逐渐添加中)

//向数据库里插入字段内容,$_G['uid']是当前页面session中uid的值

DB::query("INSERT INTO mk_tizhong (height,weight,addtime,sex,BMI,legendweight,nowstat,uid)

VALUES ('$height', '$weight', '$addtime', '$sex', '$BMI', '$legendweight','$nowstat',".$_G['uid'].");");

//选取某一天的systolic_pressure字段的平均值。

DB::query("select avg(systolic_pressure) as systolic,avg(diastolic_pressure) as diastolic from mk_xueya where uid=".$_G[uid]." and date_format(addtime,'%Y%m%e')=".date(Ym).$day);

posted @ 2012-03-09 23:30  lawdong  Views(625)  Comments(2Edit  收藏  举报
http://home.cnblogs.com/ing/