如何用FPDF分组列出用户?

  • 本文关键字:用户 何用 FPDF pdf
  • 更新时间 :
  • 英文 :


有人能帮忙吗?我需要创建一个pdf报告,列出按组分开的用户。我甚至设法列出了,但我无法以任何方式将每个用户组织到各自的组中。对于这个清单,我使用了一个WHILE函数。我想问题出在我的问题上。如有任何帮助,我将不胜感激。

CREATE TABLE `grupos_estudos` (
`codigo` int(11) NOT NULL,
`cod_grupos_estudos_sistema` int(11) NOT NULL DEFAULT '0',
`nome` varchar(60) NOT NULL DEFAULT ''
);
INSERT INTO `grupos_estudos` (`codigo`, `cod_grupos_estudos_sistema`, `nome`) VALUES
(1, 1, 'Aspectos atuais do Direito do Consumidor'),
(2, 1, 'Bioética e Biodireito IV'),
(3, 1, 'Direito Civil e proteção dos vulneráveis'),
(4, 1, 'Minorias e Grupos Vulneráveis'),
(5, 1, 'Processo penal contemporâneo'),
(6, 1, 'Projeto Diálogos Fundamentais'),
(7, 1, 'Raízes da desigualdade à luz da literatura');

CREATE TABLE `grupos_estudos_inscricoes` (
`codigo` int(11) NOT NULL,
`cod_grupos_estudos` int(11) NOT NULL DEFAULT '0',
`nome` varchar(60) NOT NULL DEFAULT '',
`celular` varchar(13) NOT NULL DEFAULT '',
`email` varchar(48) NOT NULL DEFAULT '',
`matricula` varchar(13) DEFAULT NULL,
`data_registro` datetime NOT NULL,
`hora_registro` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
);
INSERT INTO `grupos_estudos_inscricoes` (`codigo`, `cod_grupos_estudos`, `nome`, `celular`, `email`, `matricula`, `data_registro`, `hora_registro`) VALUES
(1, 0, 'wanderson', '31975631347', 'sonwander@yahoo.com.br', '12345', '0000-00-00 00:00:00', '2021-02-25 03:00:00'),
(5, 0, 'andre', '31313131313', 'email@email.com', '13245', '0000-00-00 00:00:00', '2021-02-25 13:29:33'),
(6, 0, 'paulo', '15498431687', 'teste@teste.com', '25498', '0000-00-00 00:00:00', '2021-02-25 14:39:17');

CREATE TABLE `grupos_estudos_sistema` (
`codigo` int(11) NOT NULL,
`periodo_letivo` varchar(7) NOT NULL DEFAULT '',
`situacao` varchar(8) NOT NULL DEFAULT ''
);
INSERT INTO `grupos_estudos_sistema` (`codigo`, `periodo_letivo`, `situacao`) VALUES
(1, '01/2021', 'ATIVO'),
(2, '02/2021', 'INATIVO'); 

<?php
ob_end_clean();
error_reporting(0);
require("lib/fpdf/fpdf.php");
class PDF extends FPDF
{
function Footer()
{
$this->SetY(-15);
$this->SetFont("Arial", "", 8);
$this->Cell(0, 4, $this->PageNo(), 0, 0, "R");
}
}
//$pdf = new FPDF("P", "mm", "A4");
$pdf = new PDF("P", "mm", "A4");
$pdf->SetMargins(24, 24, 24);
mysql_connect("localhost", "root", "");
mysql_select_db("relatorios");
$codigo = $_GET["codigo"];
$rs_pal = mysql_query("select codigo, nome, celular, email, matricula, data_registro, hora_registro  from grupos_estudos_inscricoes where codigo = codigo order by nome, data_registro, hora_registro");


while ($row_pal = mysql_fetch_row($rs_pal))
{
$pdf->AddPage();
$pdf->Image("img/logoFDCLtopo.png", 91, 14, 26, 22);
$pdf->SetFont("Arial", "", 11);
$pdf->Cell(160, 24, "", 0, 1, "");
$pdf->SetFont("Arial", "B", 24);
$rs = mysql_query("select nome from grupos_estudos where codigo = codigo");

$row = mysql_fetch_row($rs);
//$evento = $row[0];

//$pdf->Cell(160, 8, $row[0], 0, 1, "C");
$pdf->SetFont("Arial", "", 20);
$pdf->Cell(160, 6, "", 0, 1, "");
$pdf->Cell(160, 10, "Lista de Inscritos por Grupos de Estudos", 1, 1, "C");
$pdf->SetFont("Arial", "", 11);
//$pdf->Cell(160, 6, "", 0, 1, "");
$pdf->Cell(160, 6, "Emiss�o: " . date("d/m/Y") . " " . date("H:i:s"), 0, 1, "R");
$pdf->SetFont("Arial", "B", 12);
$pdf->Cell(160, 6, "", 0, 1, "");
$pdf->Cell(30, 6, "Data Hora: ", 0, 0, "");
$data = substr($row_pal[5], 0, 9) . " " . substr($row_pal[6], 0, 9);
$pdf->Cell(130, 6, $data, 0, 1, "");
//$pdf->Cell(30, 6, "Tema:", 0, 0, "");
//$pdf->Cell(130, 6, $row_pal[3], 0, 1, "");
//$pdf->Cell(30, 6, "Grupo:", 0, 0, "");

while($row_iter = mysql_fetch_row($rs))
{
$pdf->SetFont("Arial", "B", 12);
$pdf->Cell(130, 6, "Grupo: ".$row_iter[0], 0, 1, "");
$pdf->Cell(160, 6, "", 0, 1, "");
$pdf->Cell(24, 6, "Matr�cula", 1, 0, "");
$pdf->Cell(104, 6,"Nome", 1, 0, "");
$pdf->Cell(40, 6, "Celular", 1, 1, "");
// PEGAR INSCRITOS
$rs_insc = mysql_query("select matricula, nome, celular from grupos_estudos_inscricoes where codigo = codigo");
$pdf->SetFont("Arial", "", 12);

//$rs_insc_row = mysql_fetch_row($rs_insc);
while($rs_insc_iter = mysql_fetch_row($rs_insc))
{
$pdf->Cell(24, 6, $rs_insc_iter[0],1 , 0, "");
$pdf->Cell(104, 6, $rs_insc_iter[1],1 , 0, "");
$pdf->Cell(40, 6, $rs_insc_iter[2],1 , 1, "");

}
// FIM PEGAR INSCRITOS
$pdf->Cell(130, 6, $row_iter[1], 0, 1, "");
$pdf->Cell(130, 6, $row_iter[2], 0, 1, "");
$pdf->Cell(130, 6, $row_iter[3], 0, 1, "");
$pdf->Cell(130, 6, $row_iter[4], 0, 1, "");
$pdf->Cell(130, 6, $row_iter[5], 0, 1, "");
$pdf->Cell(130, 6, $row_iter[6], 0, 1, "");
}

}
//$pdf->Output($evento . " - Lista de Inscritos por Dia e Hor?rio.pdf", "I");
$pdf->Output(" - Lista de Inscritos por Dia e Hor?rio.pdf", "I");
?> 

我需要按用户各自的组列出用户。例如:Group process Penal (wandererson);集团biosamtica (paulo, andre)等

最新更新