-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頁面中起什麼作用?請詳細說明。 –