Hi,
I need to display data in atble format in pdf..when i am using FPDF and below slq command i receive the following error...
The user will select the year, based on the year the data will be displayed in table format in pdf…I receive the below errors….
Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-45' group by `Date`, Node_ID' at line 1
Query: -45' group by `Date`, Node_ID
My codes are as bellows:
$sql = "SELECT Node_ID ,Date, AVG(voltage),AVG(Temper), AVG(light),AVG(accel_x), AVG(accel_y), AVG(mag_x), AVG(mag_y), AVG(mic) from suhu where Date >'{$_POST['year']}-01-01' and Date <= '{$_POST['year']}-12-31'
group by `Date`,Node_ID ";
Do you know where is the error?
The user will select the year,based on the selected year ,data will be displayed.before ths ,i receive the output,but whn i am trying convert the output into pdf format,i got errors...my full coding is belows:
Code:<?php define('FPDF_FONTPATH','font/'); require('mysql_table.php'); class PDF extends PDF_MySQL_Table { function Header() { //Title $this->SetFont('Arial','',18); $this->Cell(0,6,'Average data order by node ID and Date',0,1,'C'); $this->Ln(10); //Ensure table header is output parent::Header(); } } //Connect to database mysql_connect('localhost','',''); mysql_select_db('wsn'); $pdf=new PDF(); $pdf->Open(); $pdf->AddPage(); $pdf->Table('SELECT Node_ID as node, AVG(voltage) as volt,AVG(Temper) as temper, AVG(light) as light,AVG(accel_x) as accel_x, AVG(accel_y) as accel_y, AVG(mag_x) as mag_x, AVG(mag_y)as mag_y, AVG(mic) as mic,Date as date from suhu where Date >='.'\''.$_POST['year']-01-01 .'\''.' AND Date <='.'\''.$_POST['year']-12-31 .'\''.' group by `Date`, Node_ID'); $pdf->AddPage(); $pdf->Output(); ?>
Help me...![]()
thank you



Reply With Quote
Bookmarks