i use tcpdf to generate pdf in my site...
i use the code to retrieve data from mysql and display it in a table in the pdf file...
$pdf->writeHTML('<table width="600px" border="1px">');
//data iteration
include('../connect.php');
$rer = mysql_query("SELECT * FROM complaint WHERE DATE_FORMAT(date_time,'%Y-%m-%d') between '$rep_from' and '$rep_to' order by id DESC;",$con);
while($rr=mysql_fetch_array($rer))
{
$id=$rr['id'];
$c_id=$rr['ref_id'];
$pdf->writeHTML('<tr><td>'.$c_id.'</td></tr>');
}
$pdf->writeHTML('<table>');
The problem is the code and iteration works fine... but when i use table tags, i shows
Warning: array_push() expects parameter 1 to be array, null given in tcpdf.php on line 22165
This line in the file has some thing to do with tables... what is wrong with my code???
Thanks in advance...
array_push()but I would simply use$your_array[] = 'some value';instead.array_push(), and where you declare the array you use inarray_push()mysql_queryis an obsolete interface and should not be used in new applications and will be removed in future versions of PHP. A modern replacement like PDO is not hard to learn. If you're new to PHP, a guide like PHP The Right Way can help explain best practices.