时间:2021-07-01 10:21:17 帮助过:3人阅读
您太节俭了
至少要把你看到的贴出来吧?
http://faq.comsenz.com/library/plug/construct/construct_db.htm
有文档,只是你没找到...
http://faq.comsenz.com/library/plug/construct/construct_db.htm
有文档,只是你没找到...
支持的fomat有: %tDB::table() %dintval() %saddslashes() %nin IN (1,2,3) %fsprintf('%f', $var) %i直接使用不进行处理
您太节俭了
至少要把你看到的贴出来吧?
DB::query("SHOW FIELDS FROM ".DB::table($r_table), 'SILENT'))
%t:表名占位符,DB::fetch_first("SELECT * FROM %t",array('common_member'));
%d:数值占位符,DB::fetch_first("SELECT * FROM %t WHERE uid=%d",array('common_member',1));会自动执行intval
%s:字符占位符,DB::fetch_first("SELECT * FROM %t WHERE username=%s",array('common_member','管理员'));会自动执行addslashes,转义特殊字符
%n:DB::fetch_all("SELECT * FROM %t WHERE uid IN(%n)",array('common_member',array(1,2,3)));
%f:同%d类似,只是浮点数,很少用
%i:原样输出,DB::fetch_first("SELECT * FROM %t WHERE username='%i'",array('common_member','管理员'));
%t:表名占位符,DB::fetch_first("SELECT * FROM %t",array('common_member'));
%d:数值占位符,DB::fetch_first("SELECT * FROM %t WHERE uid=%d",array('common_member',1));会自动执行intval
%s:字符占位符,DB::fetch_first("SELECT * FROM %t WHERE username=%s",array('common_member','管理员'));会自动执行addslashes,转义特殊字符
%n:DB::fetch_all("SELECT * FROM %t WHERE uid IN(%n)",array('common_member',array(1,2,3)));
%f:同%d类似,只是浮点数,很少用
%i:原样输出,DB::fetch_first("SELECT * FROM %t WHERE username='%i'",array('common_member','管理员'));
你的php基础还有待提高啊...
后面的数组就是方法fetch_first的参数,array里面的值和前面sql语句中的%t,%d..之类的占位符是一一对应的
如:DB::fetch_first("SELECT * FROM %t WHERE uid=%d",array('common_member',1));
%t=pre_common_member(会默认执行DB::table加上表前缀)
%d=1(会默认执行intval)
你的php基础还有待提高啊...
后面的数组就是方法fetch_first的参数,array里面的值和前面sql语句中的%t,%d..之类的占位符是一一对应的
如:DB::fetch_first("SELECT * FROM %t WHERE uid=%d",array('common_member',1));
%t=pre_common_member(会默认执行DB::table加上表前缀)
%d=1(会默认执行intval)