[thelist] FPDF+sql command error

jothi jothi jthjothi at yahoo.com
Wed Oct 24 00:48:32 CDT 2007


I need to display data in a tble 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:





class PDF extends PDF_MySQL_Table


function Header()




        $this->Cell(0,6,'Average data order by node ID and Date',0,1,'C');


        //Ensure table header is output





//Connect to database



$pdf=new PDF();




$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');




   whats wrong with sql commands?
  thank you

Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 

More information about the thelist mailing list