$conn = mysqli_connect("$host", "$username", "$password")or die("cannot connect");
mysqli_select_db($conn,"$db_name")or die("cannot select DB");
the below code is trying to get the MYSQL table and create the headers and columns for the table to print on a pdf page.
$result=mysqli_query($conn,"select Employee_number,date_start,date_end,Days_taken,Sick,Study,Annual,compassionate_leave,Other,Details,Status,approved_by from $tbl_name ");
$number_of_products = mysqli_num_rows($result);
//Initialize the 3 columns and the total
$column_Employee_number = "";
$column_date_start = "";
$column_date_end = "";
$column_Days_taken = "";
$column_Sick = "";
$column_Study = "";
$column_Annual = "";
$column_compassionate_leave = "";
$column_Other = "";
$column_Details = "";
$column_Status = "";
$column_approved_by = "";
$total = 0;
//For each row, add the field to the corresponding column
while($row = mysqli_fetch_array($result))
{
$Employee_number = $row["Employee_number"];
$date_start = $row["date_start"];
$date_end = $row["date_end"];
$Days_taken = $row["Days_taken"];
$Sick = $row["Sick"];
$Study = $row["Study"];
$Annual = $row["Annual"];
$compassionate_leave = ["compassionate_leave"];
$Other = $row["Other"];
$Details = $row["Details"];
$Status = $row["Status"];
$Other = $row["Other"];
$approved_by =$row["approved_by"];
$column_Employee_number =$column_Employee_number.$Employee_number."\n";
$column_date_start = $column_date_start.$date_start."\n";
$column_date_end = $column_date_end.$date_end."\n";
$column_Days_taken = $column_Days_taken.$Days_taken."\n";
$column_Sick = $column_Sick.$Sick."\n";
$column_Study = $column_Study.$Study."\n";
$column_Annual = $column_Annual.$Annual."\n";
$column_compassionate_leave = $column_compassionate_leave.$compassionate_leave."\n";
$column_Other = $column_Other.$Other."\n";
$column_Details = $column_Details.$Details."\n";
$column_Status = $column_Status.$Status."\n";
$column_approved_by = $column_approved_by.$approved_by."\n";
}
from the above code i get a error saying
Notice: Array to string conversion in C:\xampp\htdocs\Namtax\leave_view.php on line 64
which is this line
$column_compassionate_leave = $column_compassionate_leave.$compassionate_leave."\n";
and i dont seem to understand why the error is showing only for that line and not for the rest and any help on how to fix it ?
$compassionate_leave = ["compassionate_leave"];should be$compassionate_leave = $row["compassionate_leave"];?