【问题标题】:i want to result data to table我想将结果数据放到表格中
【发布时间】:2019-08-15 09:30:46
【问题描述】:

为什么要横着填满桌子? 我想下去,帮帮忙:D

控制器

  public function cetak_inbound($id){
  $pdf = new FPDF('L','mm','A4');
  $pdf->AddPage();
  $pdf->SetFont('Arial','B',10);
  $pdf->SetX(60);

  $Y_Fields_Name_position = 15;
  $pdf->SetY($Y_Fields_Name_position);
  $pdf->SetX(10);
  $pdf->Image('http://localhost/race/assets/frontend/img/logo-race.png',10);

  $pdf->ln(30);

  $cetakinb = $this->M_inbound->cetak_inbound($id);
  foreach ($cetakinb->result() as $row){
      $pdf->Cell(40,6,$row->kd_inbound,1,0);
      $pdf->Cell(25,6,$row->tgl_inbound,1,0);
      $pdf->Cell(67,6,$row->reciver_name,1,0); 
  }
  $pdf->Output();
}

型号

public function cetak_inbound($id){
    $hasil=$this->db->query("SELECT nama_cs,kd_inbound,tgl_inbound,reciver_name,inbound.status FROM inbound INNER JOIN inbound_detail ON inbound.id_inbound=inbound_detail.id_inbound INNER JOIN service ON service.id_service=inbound_detail.id_service INNER JOIN customers ON customers.id_cs=service.id_cs WHERE inbound.id_inbound='$id'");
    return $hasil;
}

【问题讨论】:

    标签: php loops codeigniter fpdf


    【解决方案1】:

    您可以像这样在最后一列中简单地添加$pdf->Ln()

    public function cetak_inbound($id){
        $pdf = new FPDF('L','mm','A4');
        $pdf->AddPage();
        $pdf->SetFont('Arial','B',10);
        $pdf->SetX(60);
    
        $Y_Fields_Name_position = 15;
        $pdf->SetY($Y_Fields_Name_position);
        $pdf->SetX(10);
        $pdf->Image('http://localhost/race/assets/frontend/img/logo-race.png',10);
    
        $pdf->ln(30);
    
        $cetakinb = $this->M_inbound->cetak_inbound($id);
        foreach ($cetakinb->result() as $row){
            $pdf->Cell(40,6,$row->kd_inbound,1,0);
            $pdf->Cell(25,6,$row->tgl_inbound,1,0);
            $pdf->Cell(67,6,$row->reciver_name,1,0);
            $pdf->Ln();
        }
        $pdf->Output();
    }
    

    【讨论】:

      猜你喜欢
      • 2020-03-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-04-10
      • 2012-03-18
      • 2017-01-28
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多