dongyi2006 2016-04-08 19:35
浏览 117

implode():传入的参数无效

 $fields_arr = "SHOW FIELDS FROM 'payslip' WHERE FIELD NOT IN ('ID','Tax_Number','Employee_Number','Payslip_Number','Salary','Bonus','  Housing_Allowance','House1','Transport_Allowance','Travel_Allowance','Vehicle_Allowance','  Vehicle1','Cellphone_Allowance','   Entertainment_Allowance','  Company_Car','  Medical_Allowance','DSocial_Security',' DHousing_Allowance','DCompany_Car','DContributions','Other_Deductions','DVehicle_Allowance','Other_Allowance','Total_Income','Taxable_Income','Tax_Payable','Overtime','Overtime_Hours','Payday','Pension','Provident_Fund','Retirement_Annuity','Study_Policy','Month','Year','Company')";

$result3 = mysqli_query($conn, $fields_arr);
$fields = implode(',',$result3);

The error comes from the above code as i thing an array is not passed but another form of data type any help on the problem ?error i get is "implode(): Invalid arguments passed "

$dql = "SELECT $fields FROM $tb2_name WHERE Month='$month' AND Year='$year' AND Employee_Number='$user' ";
  • 写回答

1条回答 默认 最新

  • doucuan5365 2016-04-08 19:41
    关注

    You must first fetch the data with for example mysqli_fetch_assoc:

    $fields_arr = "SHOW FIELDS FROM 'payslip' WHERE FIELD NOT IN ('ID','Tax_Number','Employee_Number','Payslip_Number','Salary','Bonus','  Housing_Allowance','House1','Transport_Allowance','Travel_Allowance','Vehicle_Allowance','  Vehicle1','Cellphone_Allowance','   Entertainment_Allowance','  Company_Car','  Medical_Allowance','DSocial_Security',' DHousing_Allowance','DCompany_Car','DContributions','Other_Deductions','DVehicle_Allowance','Other_Allowance','Total_Income','Taxable_Income','Tax_Payable','Overtime','Overtime_Hours','Payday','Pension','Provident_Fund','Retirement_Annuity','Study_Policy','Month','Year','Company')";
    
    $result3 = mysqli_query($conn, $fields_arr);
    $arr = mysqli_fetch_assoc($conn, $result3);
    $fields = implode(',',$arr);
    
    评论

报告相同问题?

悬赏问题

  • ¥15 关于#MATLAB#的问题,如何解决?(相关搜索:信噪比,系统容量)
  • ¥500 52810做蓝牙接受端
  • ¥15 基于PLC的三轴机械手程序
  • ¥15 多址通信方式的抗噪声性能和系统容量对比
  • ¥15 winform的chart曲线生成时有凸起
  • ¥15 msix packaging tool打包问题
  • ¥15 finalshell节点的搭建代码和那个端口代码教程
  • ¥15 Centos / PETSc / PETGEM
  • ¥15 centos7.9 IPv6端口telnet和端口监控问题
  • ¥20 完全没有学习过GAN,看了CSDN的一篇文章,里面有代码但是完全不知道如何操作