function listpost() { $sql = "SELECT postid, posttitle, postcategory FROM article LIMIT 10"; $article = new Article(); $result = $article->listarticle($query); if ($result->num_rows > 0) { $data = array(); while ($row = mysqli_fetch_assoc($result)) { array_push($data, $row); } return $data; } else { //else return 0 return 0; } echo '<pre>'; print_r($data); echo '</pre>'; }
<?php if (!isset($_SESSION['userid'])) { header('location:index.php?action=login'); } ?> <?php $article = new Article(); $alist = $article->listarticle(false); //var_dump($alist['postid']);die; ?> <!-- /.row --> <div class="row"> <div class="col-lg-12"> <div class="panel panel-default"> <h4 class="com"><?php if (isset($_SESSION['success'])) { echo $_SESSION['success']; } else { if (isset($_SESSION['error'])) { echo $_SESSION['error']; } } ?>
<?php include_once 'includes/classes/article.php'; include_once 'includes/classes/db.php'; $article = new Article(); $lists = $article->listarticle(false); //var_dump($list);die; ob_start(); ?> <?php // Include the main TCPDF library (search for installation path). require_once 'tcpdf/tcpdf.php'; // create new PDF document $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); // set document information $pdf->SetCreator(PDF_CREATOR); $pdf->SetAuthor('Nicola Asuni'); $pdf->SetTitle('TCPDF Example 001'); $pdf->SetSubject('TCPDF Tutorial'); $pdf->SetKeywords('TCPDF, PDF, example, test, guide'); // set default header data $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE . ' 001', PDF_HEADER_STRING, array(0, 64, 255), array(0, 64, 128)); $pdf->setFooterData(array(0, 64, 0), array(0, 64, 128)); // set header and footer fonts $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); // set default monospaced font $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); // set margins
<?php if (!isset($_SESSION['userid'])) { header('location:index.php?action=login'); } ?> <?php $postid = isset($_GET['id']) ? $_GET['id'] : ''; $article = new Article(); $li = $article->listarticle(true); ?> <?php foreach ($li as $k) { ?> <div class="row"> <div class="col-lg-12"> <div class="panel panel-default"> <h4 class="com"><?php if (isset($_SESSION['success'])) { echo $_SESSION['success']; } else { if (isset($_SESSION['error'])) { echo $_SESSION['error']; } } ?>