Mysql
 sql >> Teknologi Basis Data >  >> RDS >> Mysql

kesalahan fpdf dan kesalahan tampilan tabel

Pertama, Anda harus menutup semua <tr> . Anda dan <td> tag. Kedua, Anda tidak mengirim file apa pun dengan formulir Anda, dan karenanya Anda mendapatkan Undefined index: file ini kesalahan, jadi hapus baris ini,

$file_filename=$_FILES['file']['name'];
$target_path  =  "Newfolder1";
$image_path = $target_path . DIRECTORY_SEPARATOR . "filename";
$image_format = strtolower(pathinfo('filename', PATHINFO_EXTENSION));

Jadi setelah pengguna menekan view tombol, Anda harus memproses formulir Anda dan menampilkan gambar seperti ini,

// your code

if (isset($_POST['View']) ){
    $pdf=new fpdf();
    $pdf->ADDPage();
    $pdf->setfont('Arial','B', 16);  
    $pdf->Cell(40,10, 'sname',1,0,'c');
    $pdf->Cell(40,10, 'sadd',1,0,'c');
    $pdf->Cell(40,10, 'category',1,0,'c');
    $pdf->Cell(40,10, 'scode',1,0,'c');


    $con = mysqli_connect("localhost","root","","school");
    if (mysqli_connect_errno()){
        echo "Failed to connect to MySQL: " . mysqli_connect_error();
    }

    $sql="SELECT * FROM imagetable WHERE ID= '$_POST[search]'";
    $result = mysqli_query($con, $sql);
    if(!mysqli_query($con, $sql)){
        die( "Could not execute sql: $sql"); 
    }

    $row = mysqli_fetch_array($result);
    $image_path = $row['file'] . DIRECTORY_SEPARATOR . $row['filename'];  // path should be like this, process/upload/8/cdv_photo_001.jpg
    $image_format = strtolower(pathinfo($image_path, PATHINFO_EXTENSION));
    $pdf->Cell(40,10, $row['sname'],1,0,'c');
    $pdf->Cell(40,10, $row['sadd'],1,0,'c');
    $pdf->Cell(40,10, $row['category'],1,0,'c');
    $pdf->Image($image_path,50,100,50,20,$image_format);
    $pdf->ln();
    $pdf->output();
}

// your code



  1. Database
  2.   
  3. Mysql
  4.   
  5. Oracle
  6.   
  7. Sqlserver
  8.   
  9. PostgreSQL
  10.   
  11. Access
  12.   
  13. SQLite
  14.   
  15. MariaDB
  1. cara mengikat nilai INSERT INTO mysql perl

  2. libmysqlclient15-dev di mac?

  3. Cara Menyebarkan Database MySQL Chamilo untuk Ketersediaan Tinggi

  4. Masukkan nilai persia ke dalam tabel dengan kode php

  5. Umlaut Jerman di MYSQL INSERT