Вызовите данные из базы данных, чтобы поставить их в заголовок - PullRequest
0 голосов
/ 12 февраля 2019

Я делаю свою домашнюю работу с php и fpdf.Я хотел вызвать определенные данные из моей базы данных и отобразить их рядом с моим заголовком.Я все еще учусь и не могу найти никаких полезных руководств, которые дадут мне идеи о том, что делать.Я надеюсь, что вы, ребята, можете мне помочь.

<?php

mysqli_connect('localhost', 'root', '');

mysqli_select_db('storm');

$sql="SELECT * FROM twothree ORDER BY ssh DESC";

$records=mysql_query($sql);

require("library/fpdf.php");

class PDF extends FPDF{
function Header(){
    $this->SetFont('Arial', '', 10);
    $this->cell(12);
    $this->Image('logo.png',40,12,17);

    $this->Ln(5);
}
function Footer(){

    $this->SetFont('Arial', 'I', 8);
    $this->MultiCell(200,3,"\n - The public and the disaster risk reduction and management council concerned are advised to take appropriate actions and precautionary \nmeasures, and watch for the next storm surge information. \n- Inundation/flood depth due to storm surge will depend on the topography of the area(s). \n ",1,'L');

    $this->SetY(-15);
    $this->setFont('Arial','',8);
    $this->cell(0,10,'Page '.$this->PageNo()." / {pages}",0,0,'C');
}
}

$pdf = new PDF('p', 'mm', 'Legal');
$title = 'Storm Surge';
$pdf->SetTitle($title);
$pdf->AliasNbPages('{pages}');
$pdf->SetAutoPageBreak(true,15);

$pdf->AddPage();

$pdf->SetFont('Arial', 'B', 10);
$pdf->MultiCell(200,4,"   \nSTORM SURGE INFORMATION \nSTORM SURGE: WARNING #01 \nFOR: TYPHOON ROSITA (YUTU) \nISSUED AT 11AM, 29 October 2018 \n   ",1,'C', false);

$pdf->SetBorders(array('LT', 'LT', 'LT', 'LT', 'TLR'));
$pdf->SetWidths(array(30, 30, 40, 50, 50));
$pdf->SetAligns(array('C', 'C', 'C', 'C', 'C'));

$pdf->SetFont('Arial', 'B', 10);

$pdf->Row(array("SS Height",
            "Provinces",
            "Low Lying Coastal Areas in the Municipalities of:",
            "IMPACTS",
            "ADVICE/Actions to Take"), 1);

$pdf->SetFont('Arial', '', 11);

while($row = mysql_fetch_array($records)){

$pdf->Row(array($row['ssh'],
$row['provi'],
$row['muni'],
$row['impact'],
$row['advice']), 1);
}

$pdf->SetBorders(array('T', 'T', 'T', 'T', 'T'));
$pdf->Row(array('','','','',''), 1, false, 1);


$pdf->OutPut();
?>

Так что я хочу, чтобы он вывел, как на картинке, которую я прикрепил ниже.Номер предупреждения будет вызываться из базы данных так же, как и имя тайфуна, а также время и дата.

Это изображение

...