大家好,我在使用相同的外键选择数据库中的所有数据时遇到问题。但是这个代码在简单的php和html表中运行,但如果我在FPDF中调用该变量,它只显示带有外键的1行。我想显示所有数据取决于分配的外键
$queryDrinfo = "select * from drinfo";
$resultDrinfo = $mysqli->query($queryDrinfo)
while($rowDrinfo = $resultDrinfo->fetch_assoc()){
$id = $rowDrinfo['id'];
$drnum = $rowDrinfo['drnum'];
$queryItems = "select * from items where drinfo_id=".$rowDrinfo['id'];
$resultItems = $mysqli->query($queryItems);
while($rowItems = $resultItems->fetch_assoc()){
$itemnum = $rowItems['itemnum'];
$description = $rowItems['description'];
$qty = $rowItems['qty'];
$unit = $rowItems['unit'];
$remarks = $rowItems['remarks'];
$pdf->SetFont('Arial','',10);
$pdf->SetY(57.5);
$pdf->SetX(50);
$pdf->Cell(20,6,$id,0);
$pdf->SetFont('Arial','',10);
$pdf->SetY(57.5);
$pdf->SetX(50);
$pdf->Cell(20,6,$drnum,0);
$pdf->SetFont('Arial','',10);
$pdf->SetY(1);
$pdf->SetX(50);
$pdf->Cell(20,6,$drinfo_id,0);
$pdf->SetFont('Arial','',10);
$pdf->SetY(51);
$pdf->SetX(50);
$pdf->Cell(20,6,$itemnum,0);
$pdf->SetFont('Arial','',10);
$pdf->SetY(55);
$pdf->SetX(50);
$pdf->Cell(20,6,$description,0);
$pdf->SetFont('Arial','',10);
$pdf->SetY(58);
$pdf->SetX(50);
$pdf->Cell(20,6,$qty,0);
$pdf->SetFont('Arial','',10);
$pdf->SetY(62);
$pdf->SetX(50);
$pdf->Cell(20,6,$unit,0);
$pdf->SetFont('Arial','',10);
$pdf->SetY(66);
$pdf->SetX(50);
$pdf->Cell(20,6,$remarks,0);