php+mysql如何迭代mysql_result?有15列,现在就一列$wadafen = mysql_result($query, 0, '车号')
functionwadafen(){$query=@mysql_query("selecto.field2as'车号',s.field5as'装货日期',o.field1...
function wadafen(){
$query=
@mysql_query("select o.field2 as'车号',s.field5 as'装货日期',o.field14 as'客户名称',o.field6 as'采购价格',s.field3 as'装货吨位',
o.field8 as'卸货吨位',o.field9 as'结算吨位',o.field12 as'运输单价',o.field15 as'客户售价',o.field12*o.field9*o.field13
as'运输总价',o.field10*o.field9 as '销售总价',o.field6+o.field12 as'成本',f.field2 as'是否开票',f.field3
as'几票制',f.field4 as'发票号'
from crm_order o LEFT JOIN crm_storage s on o.field17=s.storage_name left join crm_salepay f on o.field17=f.field1 ");
$wadafen = mysql_result($query, 0, '车号');
return "<td align='left' class='".$CLASS."' title=\"".$wadafen."\" >".$wadafen."</td>";
}
?> 展开
$query=
@mysql_query("select o.field2 as'车号',s.field5 as'装货日期',o.field14 as'客户名称',o.field6 as'采购价格',s.field3 as'装货吨位',
o.field8 as'卸货吨位',o.field9 as'结算吨位',o.field12 as'运输单价',o.field15 as'客户售价',o.field12*o.field9*o.field13
as'运输总价',o.field10*o.field9 as '销售总价',o.field6+o.field12 as'成本',f.field2 as'是否开票',f.field3
as'几票制',f.field4 as'发票号'
from crm_order o LEFT JOIN crm_storage s on o.field17=s.storage_name left join crm_salepay f on o.field17=f.field1 ");
$wadafen = mysql_result($query, 0, '车号');
return "<td align='left' class='".$CLASS."' title=\"".$wadafen."\" >".$wadafen."</td>";
}
?> 展开
1个回答
展开全部
循环才能列出所有代码
$sql = "select * from user";//这里你需要改
$result = mysql_query($sql);
while($list = mysql_fetch_array($result,MYSQL_ASSOC)){
$return[]=$list;
}
if(!empty($return)){
echo "<table>";
foreach($return as $v){
echo '<tr>';
foreach($v as $vv){
echo "<td align='left' class='".$CLASS."' title=\"".$vv."\" >".$vv."</td>";
}
echo "</tr>\n";
}
echo "</table>";
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询