Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8743635
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T11:42:47+00:00 2026-06-13T11:42:47+00:00

here is a screenshot which can explain you more clearly about how my everysecond

  • 0

here is a screenshot which can explain you more clearly about how my everysecond cell is duplicating with the first one 1I am new to PHP and I was trying to make a pdf from fpdf but the difficulty is that I wanted to align two cell beside each other, but cells are duplicating beside each other.
Here’s my code:

require("library/fpdf/fpdf.php");
  class pdf extends fpdf {

        enter code here

       function Footer() {

        enter code here

    //Position at 1.5 cm from bottom
        $this->SetY(-15);
        //Arial italic 8
        $this->SetFont('Arial','I',8);
        //Page number
        $this->Cell(0,10,'Page '.$this->PageNo().'/{nb}',0,0,'C');

         }
     }
      $ctr=0;
     $pdf = new pdf('P','mm','A4');
     $pdf->AliasNbPages();
     $pdf->AddPage();
     $pdf->SetMargins(10,10,10);
     $pdf->SetXY(5,5);

                while ($lbl = mysql_fetch_assoc($get))
          {
                    $ctr++;
                    $pdf->SetFont('Arial','B',8);{
            $pdf->Cell(85,6,$lbl["hotelname"],1,0,'L');}
                    $pdf->SetFont('Arial','B',8);{
                    $pdf->Cell(85,6,$lbl["hotelname"],1,1,'L');}
                    $pdf->SetFont('Arial','',8);{
            $pdf->Cell(85,6,"Haji No-".$lbl["hajino"]."Ctr-"." ".$ctr,1,0,'L');
            $pdf->Cell(85,6,"Haji No-".$lbl["hajino"]."Ctr-"." ".$ctr,1,1,'L');
                    }
            $pdf->Cell(85,6,$lbl["suffix"]." ". $lbl["surname"]." ". $lbl["name"]." ". $lbl["midname"],1,0,'L');
            $pdf->Cell(85,6,$lbl["suffix"]." ". $lbl["surname"]." ". $lbl["name"]." ". $lbl["midname"],1,1,'L');

                    $pdf->SetFont('Arial','B',8);{
            $pdf->Cell(85,6,"Room No - ". $lbl["roomno"]." "." "." "." "." "." "." ". "Bus No- ".$lbl["busname"],1,0,'L');
                    $pdf->Cell(85,6,"Room No - ". $lbl["roomno"]." "." "." "." "." "." "." ". "Bus No- ".$lbl["busname"],1,1,'L');
                    $pdf->Ln(10);
                    }




              }

            $pdf->Output('Hotel_label.pdf','D');


      } // Submit Tag Close

    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T11:42:48+00:00Added an answer on June 13, 2026 at 11:42 am

    you may try the below modified version of your code..

    require("library/fpdf/fpdf.php");
      class pdf extends fpdf {
           // enter code here
    
           function Footer() {
           // enter code here
    
        //Position at 1.5 cm from bottom
            $this->SetY(-15);
            //Arial italic 8
            $this->SetFont('Arial','I',8);
            //Page number
            $this->Cell(0,10,'Page '.$this->PageNo().'/{nb}',0,0,'C');
    
             }
         }
          $ctr=0;
    
          $yheight=5;  //assign value for y-axis
    
         $pdf = new pdf('P','mm','A4');
         $pdf->AliasNbPages();
         $pdf->AddPage();
         $pdf->SetMargins(10,10,10);
         $pdf->SetXY(10,$yheight);
    
    
    $loopvariable=1; //to check page break
    
    $side=0;//to check left or right record placement
    
                    while ($lbl = mysql_fetch_assoc($get))
              {
                        $ctr++;
                        if($side==0){                   
                        $pdf->SetFont('Arial','B',8);{
                $pdf->Cell(85,6,$lbl["hotelname"],1,1,'L');         
                $pdf->Cell(85,6,"Haji No-".$lbl["hajino"]."Ctr1-"." ".$ctr,1,1,'L');            
                $pdf->Cell(85,6,$lbl["suffix"]." ". $lbl["surname"]." ". $lbl["name"]." ". $lbl["midname"],1,1,'L');
                $pdf->Cell(85,6,"Room No - ". $lbl["roomno"]." "." "." "." "." "." "." ". "Bus No- ".$lbl["busname"],1,1,'L');
                $pdf->Ln(10);
                         }
    
                        $side++;
    
                        }else{
    
    
    
                             $pdf->SetFont('Arial','B',8);{
                                  $pdf->SetXY(100,$yheight);
                $pdf->Cell(85,6,$lbl["hotelname"],1,1,'L');  
                                  $pdf->SetXY(100,$yheight+6);
                $pdf->Cell(85,6,"Haji No-".$lbl["hajino"]."Ctr2-"." ".$ctr,1,1,'L');
                             $pdf->SetXY(100,$yheight+12);
                $pdf->Cell(85,6,$lbl["suffix"]." ". $lbl["surname"]." ". $lbl["name"]." ". $lbl["midname"],1,1,'L');
                 $pdf->SetXY(100,$yheight+18);
                $pdf->Cell(85,6,"Room No - ". $lbl["roomno"]." "." "." "." "." "." "." ". "Bus No- ".$lbl["busname"],1,1,'L');
                $pdf->Ln(10);
                        }
                        $side--;        
                        $yheight+=34;
                    if($loopvariable%16==0){$yheight=10;}//reset the y-axis value after every 16 records i.e. after every page break
    
                        }
    
    
    $loopvariable++;
    
                  }
    
                $pdf->Output('Hotel_label.pdf','D');
    
    
    
          } // Submit Tag Close
    
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I really can't explain this one properly, so here's a screenshot: How do I
More than a long talk to explain that bug, here's a screenshot that explains
I'm using PHP/Java bridge for the gain capital API which you can found here
Here's a screenshot of what I'm dealing with: As you can see, the spacing
![enter image description here][1]On my two demo and screenshot, you can understand that so
This is my first project which I've encountered that I can't get by on
On a website I made, one person sent me a screenshot which shows that
Here is a screenshot of my Project: The lines hidden behind the error window
Here's a screenshot of my AlertDialog's unresponsive state: In the background, the green tile,
https://i.stack.imgur.com/dtnpg.png Here is a screenshot of it. I am running svn on Windows 7,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.