php - Printing a report from selected data (MySQL) -


say table displayed on website (containing table data mysql database). example:

   id      name       email      x       date    0       aaa        aa@a.com   ccc     10 jan 1993    1        bbb       nn\\.com   fff     20 feb 1994 etc 

i want have drop down lists or radio buttons selecting data want display in report. (for instance, want select data date : february 1994 or whatever) want click button print selected data in report form. (i'm interested in code button.)

can please recommend tutorial or maybe piece of code help?

i'm writing website using php , mysql database.

******edit part of code displaying table on webpage. suggestions?

   $table = 'table';      if (!mysql_connect($db_host, $db_user, $db_pwd))     die("can't connect database");      if (!mysql_select_db($database))     die("can't select database");      // sending query     $result = mysql_query("select * {$table}");     if (!$result) {     die("query show fields table failed");     }      $fields_num = mysql_num_fields($result);      echo "<h2>table: database </h1>";   ?>       <input name='print' type='print' id="print" value='print'>     <?php      echo "<table border='3'><tr>";     // printing table headers      for($i=0; $i<$fields_num; $i++)      {       $field = mysql_fetch_field($result);       echo "<td>{$field->name}</td>";      }      echo "</tr>\n";      // printing table rows      while($row = mysql_fetch_row($result))      {        echo "<tr>";       // $row array... foreach( .. ) puts every element      // of $row $cell variable       foreach($row $cell)       echo "<td>$cell</td>";         echo "</tr>\n";       }       mysql_free_result($result);       ?> 

when report, talking pdf? if that's case recommend read mpdf. http://www.mpdf1.com/mpdf/index.php

this class convert html codes pdf report.

for button create form accepts date input can use query database when click submit.


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

python - Django-cities exits with "killed" -

python - How to get a widget position inside it's layout in Kivy? -