I am new to PHP. I performed some tasks of saving / editing files and viewing data from mysql table. I found some code from the internet that can export selected mysql data to pdf. but two steps are required. I need your help to get information, if any user clicks an entry on the view page (view.php), it will generate a pdf file of the selected reocrd from the mysql table instead of going to the next page. it is currently outputting all output from the mysql table instead of giving the selected output of the record. I am below, this is my code, as long as I have a dome.
view.php
<?php
include('ps_pagination.php');
$conn = mysql_connect('localhost','root','xyz');
if(!$conn) die("Failed to connect to database!");
$status = mysql_select_db('test', $conn);
if(!$status) die("Failed to select database!");
$sql = 'SELECT * FROM customer order by CustomerID DESC';
$pager = new PS_Pagination($conn, $sql, 10, 5);
$rs = $pager->paginate();
$result = mysql_query("SELECT * FROM customer order by CustomerID DESC");
while($row = mysql_fetch_array($rs))
{
echo '<td><div align="left">'.$row['CustomerID'].'</td>';
echo '<td><div align="left">'.$row['Name'].'</div></td>';
echo '<td><div align="left">'.$row['Email'].'</div></td>';
echo '<td><div align="left">'.$row['CountryCode'].'</td>';
echo '<td><div align="left">'.$row['Budget'].'</div></td>';
echo '<td><div align="left">'.$row['Used'].'</div></td>';
echo "<td><a href=\"php_pdf_mysql.php?CustomerID=$row[CustomerID]\"><img src='Printer.jpg' width='40' height='30'/></a></td>";
echo '</tr>';
}
?>
php_pdf_mysql.php
// Load MySQL data
$objConnect = mysql_connect("localhost","root","xyz") or die(mysql_error());
$objDB = mysql_select_db("test");
$strSQL = "SELECT * FROM customer";
$objQuery = mysql_query($strSQL);
$resultData = array();
for ($i=0;$i<mysql_num_rows($objQuery);$i++) {
$result = mysql_fetch_array($objQuery);
array_push($resultData,$result);
}
Your information is much appreciated.