-1
我有一个问题,我已经检索到一个行的所有细节到PDF页面,但问题是,当我点击它在浏览器中的回声的ID,但不是特定数据库中的id记录。从数据库显示特定的行细节到PDF页面在PHP
稍作修改,在每个点击的按钮上显示mysql的第一行。
有时显示PDF页面上的所有记录。
例如:如果一条记录覆盖2页的PDF页面,那么它将显示10页的pdf页面中显示的所有行。
当我更改像Select * from students where id = '$id'
这样的sql查询时,会出现此错误。
(未定义的变量:ID在C:\ XAMPP \ htdocs中\登录注册 系统\ ADMIN \包括\ PDF \的index.php上线13)
请帮助我。
它从我所说的PDF页面的按钮:
<th scope="row"><a href="includes/pdf/index.php?action=select&id=<?php echo $id; ?>" class="btn btn-success">Print</a></th>
现在它的PDF索引页:
<?php
require('library/fpdf.php');
include("pconnect.php");
$sql = "SELECT * FROM students ";
$result = mysqli_query($con, $sql);
while($rows = mysqli_fetch_array($result))
{
$pdf = new FPDF();
$pdf->AddPage();
$pdf->SetFont('Arial', 'B', 10);
$pdf->Ln();
$pdf->Ln();
$pdf->Ln();
$pdf->SetFont('times', 'B', 10);
$pdf->Cell(30, 20, 'Name on Passport', 1, 0);
$pdf->Cell(60, 10, $rows['firstname'], 1, 0, 'C');
$pdf->SetX(40);
$pdf->Cell(60, 10, $rows['lastname'], 1, 0, 'C');
$pdf->Cell(30, 10, 'Nationality', 1, 0, 'C');
$pdf->Cell(45, 10, $rows['nationality'], 1, 0, 'C');
$pdf->SetX(85);
$pdf->Cell(28, 10, 'Place of Birth', 1, 0);
$pdf->Cell(42, 10, $rows['placeofbirth'], 1, 1, 'C');
$pdf->Cell(30, 10, 'Date of Birth', 1, 0);
$pdf->Cell(73, 10, $rows['dateofbirth'], 1, 0, 'C');
$pdf->Cell(42, 10, $rows['gender'], 1, 0, 'C');
$pdf->SetY(60);
$pdf->SetX(155);
$pdf->Cell(45, 40, $rows['Photo'], 1, 1, 'C');
$pdf->Output();
}?>
所以,你想要什么。你想在PDF中的特定用户的记录?对?而且,您在PDF页面中使用'action'和'id'的位置?这些参数的用途是什么 –
是的,你是正确的以PDF格式获取特定用户。我认为这是我从一个页面调用动作到PDF索引但不能写入动作的问题。我对写什么感到困惑。请帮我解决这个问题。 –
'action'有什么作用?意思,它在你的PDF页面中起什么作用?请详细说明。 –