PHP插入数据库错误

时间:2017-08-09 11:19:42

标签: php mysql database

我知道$ data包含许多特殊字符,但我想按原样插入它,因为我正在从数据生成pdf ...

但是我收到了错误

  

您的SQL语法有错误;检查与MariaDB服务器版本对应的手册,以便在'Courier','B',15)附近使用正确的语法; $ pdf-> Cell(0,10,'TAX INVOICE',0,1,'C '); $ pdf->图片(第10行'xyz.png',10'

<?php 
    include "../includes/db.php";
    $data = "\$pdf->SetFont('Courier','B',15);";
    $data .= "\$pdf->Cell(0,10,'TAX INVOICE',0,1,'C');";
    $data .= "\$pdf->Image('xyz.png',10,20,20,20);";
    $data .= "\$pdf->Cell(0,6,'Mercury Fire Protection LLP','LTR',1,'C');";
    $data .= "\$pdf->SetFont('Arial','B',10);";
    $data .= "\$pdf->Cell(0,4,'Factory: R-598, T.T.C.,','LR',1,'C');";
    $data .= "\$pdf->Cell(0,4,'Navi Mumbai-400708','LR',1,'C');";
    $data .= "\$pdf->Cell(0,4,'Tel: +91 22 27691693, +91 22 651152255','LR',1,'C');";
    $data .= "\$pdf->Cell(0,6,'Email : info@mercuryfire.in, Website : www.mercuryfire.in','LBR',1,'C');";
    $data .= "\$pdf->SetFont('Arial','B',7);";
    $data .= "\$pdf->Cell(70,3,'',1,0,'C');";



    $query = "INSERT into bill(bill_data) VALUES('$data')";
    //eval($data);
    $result = mysqli_query($connection, $query);
    if(!$result){
        echo mysqli_error($connection);
    }
    $id = mysqli_insert_id($connection);
    echo $id;
    ?>

我做错了什么

0 个答案:

没有答案