$conn = mysqli_connect("$host", "$username", "$password")or die("cannot connect");
mysqli_select_db($conn,"$db_name")or die("cannot select DB");
以下のコードは、MYSQLテーブルを取得し、pdfページに印刷するテーブルのヘッダーと列を作成しようとしています。上記のコードから は、文字列変換エラーへの配列を持っています
$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";
}
iはというエラーを取得
お知らせ:Cの文字列への変換アレイ:\ xamppの\ htdocsに\ Namtax \ leave_view.phpライン上の64
これはこの行です
$column_compassionate_leave = $column_compassionate_leave.$compassionate_leave."\n";
と私はなぜエラーが表示されているのか理解していないようですその行のためのものであり、残りの部分とそれを修正する方法についての助けとではないでしょうか?
'$ compassionate_leave = [" compassionate_leave "];'は '$ compassionate_leave = $ row [" compassionate_leave "];'にする必要があります。 – Matt