$sql = " SELECT Salary,Bonus,Housing_Allowance,Transport_Allowance,Travel_Allowance,Vehicle_Allowance,Cellphone_Allowance,Entertainment_Allowance,Company_Car,Medical_Allowance FROM $tb2_name WHERE Month='$month' AND Year='$year' AND Employee_Number='$user'";
$result = mysqli_query($conn, $sql);
$rows = mysqli_fetch_assoc($result);
// This code works fine as the array are printed under each other . thanks to the \n
$data = array();
foreach($rows as $key => $value) {
if($value > 0) {
$me = $key . " : " . $value . "\n";
$pdf->MultiCell(63, 10, $me, 2);
}
}
Yukarıdaki kodlar, dizinin değerleri birbirinin altında yazdırıldığı için mükemmel çalışır. pdf sayfası ve kümelenmemiş. i2 dizide 2 diziyi pdf'ye yazdırmaya çalışıyor ancak ilk dizi küme halinde yazdırılırken ilk dizi doğru yazdırılıyor, birbirinin üstündeki değerler
$pdf->SetXY($x + 35, $y);
$col2="Deductions Other Deductions ";
$col3="Deductions\n \n $DSocial_Security \n $DContributions \n $DVehicle_Allowance \n $Other_Deductions";
$wql = " SELECT Housing_Allowance,Vehicle_Allowance,Company_Car,DContributions,Pension, Provident_Fund,Retirement_Annuity,Study_Policy FROM $tb2_name WHERE Month='$month' AND Year='$year' AND Employee_Number='$user'";
$results = mysqli_query($conn, $wql);
$rows1 = mysqli_fetch_assoc($results);
yanındaki sütunda aynı şeyi yapmaya çalıştığınızda sorun sorun Buraya gelen kod sonraki azar gelir. Bu yürütüldüğünde, sonuç birbirinin üzerine yazdırılır ve kümelenir ve birbirinin altında değil, \ n diyor.
$data1 = array();
foreach($rows1 as $key => $value) {
if($value > 0) {
$me = $key . " : " . $value . "\n";
$pdf->SetXY($x + 60 ,$y);
$pdf->MultiCell(63, 10, $me, 3);
}
}
the above code does not print the array so that the values line up under each other but the values line up on top of each other and are clustered.
$pdf->SetXY($x + 95 ,$y);
$pdf->SetXY($x + 120 ,$y);
$pdf->MultiCell(63, 10, $col2, 3);
pdf için hangi uzantıyı kullandınız? – jilesh