2013-12-21 42 views
0

這是代碼FPDF頁不完全加載在Internet服務器,但正確工作在本地服務器

<?php  
require('../fpdf/fpdf.php');  
$pdf = new FPDF('P','in',"LEGAL");  

include_once "../__accinfo.php";  
$link_id=mysql_connect($dbhost, $dbusername, $dbuserpassword) or die("Unable To Connect To Server");  

include_once "dbinfo.inc";  
mysql_select_db($dbname) or die("Unable to Connect To Database");  

$starting=$_POST['rno_start'];  
$ending=$_POST['rno_end'];  
$lmargin=0.5;  
$rmargin=7.5;  

$qry="select * from $dbname where `group`='$_POST[grp]' and inst_code=$_SESSION[INST_CODE] and not isnull(finalized) and serialno>=$starting and serialno<=$ending ORDER BY serialno ASC";  

$result=mysql_query($qry, $link_id);  
$grup="PRE-MEDICAL GROUP";  

$countofrecords=9;  
$title=1.0;  
$cnt=0; $ln[0]=1.5;  
while($cnt<10) {$cnt++;  
    $ln[$cnt]=$ln[$cnt-1]+1.1;  
}  
while($data=mysql_fetch_array($result))  
{  
    $countofrecords=$countofrecords+1;  
    if($countofrecords==10) {  
     $countofrecords=0;  

     $pdf->AddPage();  

     $pdf->SetFont('Times','B',12);  
     $txt="BOARD OF INTERMEDIATE AND SECONDARY EDUCATION MULTAN";      
     $pdf->Cell(0,0,$txt,0,1,'C');     $pdf->ln(0.2);  
     $txt="REGISTRATION INTERMEDIATE (11th) 2013-15  $grup";     
     $pdf->Cell(0,0,$txt,0,1,'C');       $pdf->ln(0.3);  
     $txt="($_SESSION[INST_CODE]) $_SESSION[INST_NAME]";     
     $pdf->Cell(0,0,$txt,0,1,'C');  

     $pdf->rect($lmargin,1.0,$rmargin,11.5);     //the main rectangle box  
     $cnt=-1;  
     while($cnt<9) {$cnt++;  
      $pdf->Line($lmargin,$ln[$cnt],$rmargin+.5,$ln[$cnt]);    
     }  
     $col1=$lmargin+.5; $col2=$col1+0.8; $col3=$col2+2.5;  
     $col4=$col3+0.8; $col5=$col4+0.7; $col6=$col5+1.3;  
     $pdf->Line($col1,$title,$col1,$ln[10]);  
     $pdf->Line($col2,$title,$col2,$ln[10]);  
     $pdf->Line($col3,$title,$col3,$ln[10]);  
     $pdf->Line($col4,$title,$col4,$ln[10]);  
     $pdf->Line($col5,$title,$col5,$ln[10]);  
     $pdf->Line($col6,$title,$col6,$ln[10]);  

     $pdf->SetFont('Times','B',10);  
     $pdf->Text($lmargin+.02,$title+.2,"College");  
     $pdf->Text($lmargin+.02,$title+.4," RNO");  
     $pdf->Text($col1+.1,$title+.2,"Date Of");  //$pdf->Text(3,3,"TEXT TO DISPLAY");  
     $pdf->Text($col1+.1,$title+.4,"Admission");  
     $pdf->Text($col2+.5,$title+.2,"Name/Father");  
     $pdf->Text($col3+.1,$title+.15,"SSC RNO");  
     $pdf->Text($col3+.1,$title+.30,"SESSION");  
     $pdf->Text($col3+.1,$title+.45,"BOARD");  
     $pdf->Text($col4+.1,$title+.2,"Subjects");  
     $pdf->Text($col5+.1,$title+.2,"B-Form/F-CNIC");  
     $pdf->Text($col5+.1,$title+.4,"/ Contact");  
     $pdf->Text($col6+.15,$title+.2,"Picture");  
    } 
     list($y,$m, $d) = split('[/.-]', $data["DOA"]);      
     $doa=$d."/".$m."/".$y;  

     $imgpath="studentpics/P$data[INST_CODE]$data[CRNO].jpg";  
     if(file_exists($imgpath))  
      $pdf->Image($imgpath,7.15,$ln[$countofrecords]+0.1,.75,.85);  


     $pdf->SetFont('Times','B',11);  
     $pdf->Text($col1+.05,$ln[$countofrecords]+0.2,$doa);  

     $pdf->Text($col3+.05,$ln[$countofrecords]+0.25,$data["MRNO"]);  
     $pdf->Text($col3+.02,$ln[$countofrecords]+0.5,$data["MSESSION"]);  
     $pdf->Text($col3+.05,$ln[$countofrecords]+0.75,$data["MBISE"]);  

     $pdf->Text($col5+.05,$ln[$countofrecords]+0.2,$data["CNIC"]);  
     $pdf->Text($col5+.05,$ln[$countofrecords]+0.5,$data["FCNIC"]);  
     $pdf->SetFont('Times','B',8);   
     $pdf->Text($col5+.05,$ln[$countofrecords]+0.75,$data["CONTACT"]);  
     $pdf->SetFont('Times','B',11);  
     $pdf->Text($lmargin+.15,$ln[$countofrecords]+0.3,$data["SERIALNO"]);  
     $pdf->Text($col2+.07,$ln[$countofrecords]+0.2,$data["NAME"]);  
     $pdf->Text($col2+.07,$ln[$countofrecords]+0.5,$data["FATHER"]);  

     $pdf->Text($col4+.02,$ln[$countofrecords]+0.2,$data["APPEAR4"]);  
     $pdf->Text($col4+.02,$ln[$countofrecords]+0.4,$data["APPEAR5"]);  
     $pdf->Text($col4+.02,$ln[$countofrecords]+0.6,$data["APPEAR6"]);  
     $pdf->Text($col4+.02,$ln[$countofrecords]+0.8,$data["APPEAR7"]);  
     if($data["APPEAR3"]!="IE")  
      $pdf->Text($col4+.15,$ln[$countofrecords]+0.8,$data["APPEAR3"]);  

     $pdf->SetFont('Times','B',10);  
     if($data["OREGNO"]!="")  
      $pdf->Text($col2+.1,$ln[$countofrecords]+0.75,"Prev. Reg# ".$data["OREGNO"]);  

     $pdf->SetFont('Times','B',8);   
     $pdf->Text($col1+.05,$ln[$countofrecords]+1,"Address: ".$data["ADDRESS"]);  
}  
$pdf->Text($lmargin+.5,13,"Signature _____________________");  
$pdf->Text($rmargin-2,13,"Stamp _____________________");  
$pg=$pdf->pageNo();  
$pdf->Text($lmargin+3.1,13,"Page: $pg");  

$filename="reg2013.pdf";  
$pdf->Output($filename,'I');  
    ?>    

但網頁不負載。 記住一件事。它在我的本地服務器上正常工作並正確生成輸出。但是當我上傳在互聯網服務器上的腳本,它不顯示任何輸出。

回答

0

該方案有至少三個外部的依賴關係:

  • ../fpdf/fpdf.php
  • ../__accinfo.php
  • dbinfo.inc

,他們都在不同的目錄。你確定這兩臺機器都具有這些匹配嗎?然後所有這些包括等等?


更多:

看來奇怪的是,這些線是有序的,因爲它們是:

$link_id=mysql_connect($dbhost, $dbusername, $dbuserpassword) ... 
include_once "dbinfo.inc"; 

哪裏$db *定義的變量? (但願../__accinfo.php

+0

這些文件沒有問題。我已經檢查了這些 –

+0

@adeeliqbal:我已經修改了我的答案和另一個可能的問題。 – wallyk

+0

是這些變量在__accinfo.php中。我的問題仍然沒有解決。我的本地計算機正在運行wamp(windows)。不過我的網絡服務器在linux上是 –

0

檢查DBHOST,數據庫用戶名和DBPASSWORD如果它從本地服務器的數據數據符合您的Internet服務器

常見的錯誤是未能更新到互聯網服務器數據

mysql_connect($dbhost, $dbusername, $dbuserpassword) 
+0

其正確的。我已經正確地檢查了數據 –

相關問題