gnawz Posted September 11, 2008 Share Posted September 11, 2008 Hi. I need help on how to generate a printable version of a report or records read from a MySQL database using PHP. Below is my code <? require_once '../../functions.php'; $sql = "SELECT * FROM fragrancestock WHERE Quantity = '0'"; $rowsPerPage = 10; $result = dbQuery(getPagingQuery($sql, $rowsPerPage)); $pagingLink = getPagingLink($sql, $rowsPerPage); ?> <form action="index.php?view=add" method="post" name="frmList" id="frmList"> <table width="700" border="0" align="center"> <tr class="title_text"> <td colspan="7"><? echo $errorMessage; ?></td> </tr> <tr class="title_text"> <td width="200">Category</td> <td width="200">Brand</td> <td width="200">Available Stock</td> <td width="200">Date Added</td> <td width="50">View</td> <td width="50">Add</td> <td width="50">Delete</td> </tr> <?php if (dbNumRows($result) > 0) { $i = 0; while($row = dbFetchAssoc($result)) { extract($row); if ($i%2) { $class = 'row1'; } else { $class = 'row2'; } $i += 1; ?> <tr class="<?php echo $class; ?>"> <td width="200"><?php echo $Category; ?></td> <td width="200"><?php echo $Brand; ?></td> <td width="200" class="inner_border"><?php echo $Quantity; ?></td> <td width="200"><?php echo $DateAddedStock; ?></td> <td width="50" align="center" ><a href="<?php echo $_SERVER['PHP_SELF']; ?>?view=detail&StockID=<?php echo $StockID; ?>">Details</a></td> <td width="50" align="center" ><a href="javascript:modifyStock(<?php echo $StockID; ?>);"><strong>Add </strong> </a></td> <td width="50" align="center" ><a href="javascript:deleteStock(<?php echo $StockID; ?>);">Delete</a></td> </tr> <?php } // end while ?> <tr> <td colspan="7" align="center"> <?php echo $pagingLink; ?> </td> </tr> <?php } else { ?> <tr> <td colspan="7" align="center">No stock for <? echo '<strong>'; echo $ShowBrand; echo ' '; echo "</strong>"; ?></td> </tr> <?php } ?> <tr> <td colspan="7"> </td> </tr> <tr> <td colspan="6" align="right"> <input name="btnAddStock" type="submit" value="New Entry" class="button_image"> <td align="right"><input name="btnCancel" type="button" id="btnCancel" value="Return" onClick="window.location.href='index.php';" class="button_image"></tr> </table> <p> </p> </form> Quote Link to comment Share on other sites More sharing options...
BlueSkyIS Posted September 11, 2008 Share Posted September 11, 2008 i use fpdf: http://fpdf.org/ Quote Link to comment Share on other sites More sharing options...
Mchl Posted September 11, 2008 Share Posted September 11, 2008 So do I. Actually I use UFPDF which is a unicode extension to original FPDF (a bit buggy though) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.