benhodgson Posted September 7, 2006 Share Posted September 7, 2006 I have the following piece of code, designed for the print-out of ID cards for a member system.[code]$query="SELECT * FROM memb WHERE id_printed='0'";$result=mysql_query($query) or die("<strong>Error ".mysql_errno().":</strong><br> ".mysql_error()."<br><br>\nQuery: $query");$num=mysql_numrows($result);mysql_close();$i=0;while ($i < $num) {$id=mysql_result($result,$i,"id");$first=mysql_result($result,$i,"first_name");$last=mysql_result($result,$i,"surname");$exec_pos=mysql_result($result,$i,"exec_pos");$day=mysql_result($result,$i,"joined_day");$month=mysql_result($result,$i,"joined_month");$year=mysql_result($result,$i,"joined_year");$image=mysql_result($result,$i,"image");if(empty($image)){ $image = "http://www.demonfm.co.uk/images/members/membphotos/nophoto.gif";}if (!($exec_pos=='') && !($exec_pos=='None') && !($exec_pos=='none')){echo "<div class=\"idmem\"> <div class=\"extimg\"> <img src=\"name.png\" alt=\"name\" /> </div> <div class=\"fbg\"> <img src=\"fbg.png\" alt=\"fieldbg\" /> </div> <div class=\"fname\"> <span class=\"text\">$first $last</span> </div> <div class=\"extimg\"> <img src=\"valid.png\" alt=\"validuntil\" /> </div> <div class=\"fbg\"> <img src=\"fbg.png\" alt=\"fieldbg\" /> </div> <div class=\"fjoin\"> <span class=\"text\">$day $month $year</span> </div> <div class=\"extimg\"> <img src=\"exec.png\" alt=\"execpos\" /> </div> <div class=\"fbg\"> <img src=\"fbg.png\" alt=\"fieldbg\" /> </div> <div class=\"fjoin\"> <span class=\"text\">$exec_pos</span> </div> <div class=\"exfid\"> <span class=\"id\">$id</span> </div> <div class=\"exfpic\"> <img src=\"$image\" width=\"99\" height=\"128\" alt=\"memberpic\" /><br /> <img class=\"logo\" src=\"logo.png\" alt=\"demonlogo\" /> </div></div>";}else{echo "<div class=\"idmem\"> <div class=\"timg\"> <img src=\"name.png\" alt=\"name\" /> </div> <div class=\"fbg\"> <img src=\"fbg.png\" alt=\"fieldbg\" /> </div> <div class=\"fname\"> <span class=\"text\">$first $last</span> </div> <div class=\"timg\"> <img src=\"valid.png\" alt=\"validuntil\" /> </div> <div class=\"fbg\"> <img src=\"fbg.png\" alt=\"fieldbg\" /> </div> <div class=\"fjoin\"> <span class=\"text\">$day $month $year</span> </div> <div class=\"fid\"> <span class=\"id\">$id</span> </div> <div class=\"fpic\"> <img src=\"$image\" width=\"99\" height=\"128\" alt=\"memberpic\" /><br /> <img class=\"logo\" src=\"logo.png\" alt=\"demonlogo\" /> </div></div>";}$i++;}[/code]8 cards will fit onto a single A4 sheet of paper. The problem is that the next two cards then span across two sheets, cutting them in half.Is there any way to insert a blank space (Probably as an image or empty DIV) every 8 records to push the next two cards down to the next page and, based on the code above, what would be the easiest way to do this?Thanks in advance. Quote Link to comment Share on other sites More sharing options...
Woolf Posted September 7, 2006 Share Posted September 7, 2006 Use something likeif($i % 8 == 0){//show spacer image or whatever}That should separate them. Quote Link to comment Share on other sites More sharing options...
Barand Posted September 8, 2006 Share Posted September 8, 2006 If I need precision printing I generate a PDF file instead of relying on a print of the html page.see http://www.fpdf.org 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.