时间:2021-07-01 10:21:17 帮助过:2人阅读
function wc1($sql){
$tb='';
$showArr=array();
$q=$this->getAll3($sql);
while ($r=$q->fetch_array(MYSQLI_USE_RESULT)) {
$tb.=''.$r["number"].' ';
$tb.=isset($this->show["customer"])?''.$r["customer"].' ':NULL;
$tb.=isset($this->show["orderNo"])?''.$r["orderNo"].' ':NULL;
}
return $tb;
}
function wc2($sql){
$tb='';
$showArr=array();
$q=$this->getAll3($sql);
while ($r=$q->fetch_array(MYSQLI_USE_RESULT)) {
$tb.=''.$r["number"].' ';
$tb.=isset($this->show["customer"])?''.$r["customer"].' ':NULL;
$tb.=isset($this->show["orderNo"])?''.$r["orderNo"].' ':NULL;
$tb.=isset($this->show["name"])?''.$r["name"].' ':NULL;
$tb.=isset($this->show["wc"])?''.$r["wc"].' ':NULL;//----------------此处有变化
}
return $tb;
}
function wc3($sql){
$tb='';
$showArr=array();
$q=$this->getAll3($sql);
while ($r=$q->fetch_array(MYSQLI_USE_RESULT)) {
$tb.=''.$r["number"].' ';
$tb.=isset($this->show["customer"])?''.$r["customer"].' ':NULL;
$tb.=isset($this->show["orderNo"])?''.$r["orderNo"].' ':NULL;
$tb.=isset($this->show["name"])?''.$r["name"].' ':NULL;
$tb.=isset($this->show["fsaww"])?''.$r["sfs3"].' ':NULL;//----------------此处有变化
}
return $tb;
}
------解决方案--------------------
function wc($sql){
$tb='';
$showArr=array();
$q=$this->getAll3($sql);
$dict = array('fsaww' => 'sfs3'); //这里是对照表
while ($r=$q->fetch_array(MYSQLI_USE_RESULT)) {
$tb.=''.$r["number"].' ';
foreach($this->show as $k) {
if(isset($dict[$k])) $k = $dict[$k];
$tb.=''.$r[$k].' ';
}
}
return $tb;
}
------解决方案--------------------
function wc1($sql, $assoc = array()){
$tb='';
$showArr = array();
$q=$this->getAll3($sql);
while ($r=$q->fetch_array(MYSQLI_USE_RESULT)) {
$tb.=''.$r["number"].' ';
if(count($assoc)){
foreach($keys as $k => $v){
$tb .= isset($this->show[$k]) ?''.$r[$v].' ':NULL;
}
}
}
return $tb;
}
wc1($sql, array('customer' => 'customer', 'orderNo' => 'orderNo'));
wc1($sql, array('customer' => 'customer', 'orderNo' => 'orderNo', 'name' => 'name', 'wc' => 'wc'));
wc1($sql, array('customer' => 'customer', 'orderNo' => 'orderNo', 'name' => 'name', 'fsaww' => 'sfs3'));
人气教程排行
-
174次
1
php如何获取跳转前的url
-
174次
2
php格林威治时间转换成当前时间的方法
-
174次
3
为什么php不能做大型系统?
-
174次
4
range函数怎么用
-
174次
5
php中计算页面加载时间几种方法总结_PHP教程
-
174次
6
求帮助,关于paypal支付返回值修改订单状态
-
174次
7
typecho怎么配置文章内容页?
-
174次
8
PhpStorm左侧structure不显示文件的方法列表是这么回事?
-
174次
9
查看PHP的环境变量_PHP
-
174次
10
PHP Primary script unknown 解决方法总结
-
174次
11
php的命名空间与自动加载实现方法
-
174次
12
解决laravel 出现ajax请求419(unknown status)的问题
-
173次
13
php 如何删除mysql记录
-
173次
14
PHP如何替换数组中的指定元素
-
173次
15
怎么去除字符串中非汉字、非字母、非数字的字符
-
173次
16
mysql如何一次执行多条SQL语句
-
173次
17
修改header里面的Connection为close解决方法
-
173次
18
PHP基于session.upload_progress 实现文件上传进度显示功能详解
-
173次
19
php5.6.x到php7.0.x特性小结
-
172次
20
php为什么会出现504错误