There is an array $ rowarray (& quot; username & quot; & amp; gt; & quot; admin & quot; mail & quot; & amp; gt; & quot; admin@admin.com & quot; id & quot; & amp; gt; & quot; 1 & quot;) I want to output {code ...} why is the table messy? The column width of each table changes.
There is an array
$ Row = array ("username" => "admin" "mail" => "admin@admin.com" "id" => "1 ")
I want to output
echo "
";echo "
";echo "
| ".$row['id']." | ";echo "
".$row['username']." | ";echo "
".$row['id']." | ";echo "
";echo "
";
Why is the table messy? The column width of each table changes.
Reply content:
There is an array
$ Row = array ("username" => "admin" "mail" => "admin@admin.com" "id" => "1 ")
I want to output
echo "
";echo "
";echo "
| ".$row['id']." | ";echo "
".$row['username']." | ";echo "
".$row['id']." | ";echo "
";echo "
";
Why is the table messy? The column width of each table changes.
You shouldn't have created a new table for each row.
Set the style of the table.
Foreach loop should be in table, not outside
Let's take a look at the figure you posted. The row split line is rough and the column split line is fine. Most of the rows are a table.
Traverse tr td
First, your array is not written. It should be$row=array("username"=>"admin","mail"=>"admin@admin.com","id"=>"1");
If your array is a one-dimensional array
echo "
";echo "
";echo "
| ".$row['id']." | ";echo "
".$row['username']." | ";echo "
".$row['id']." | ";echo "
";echo "
";
If the array is a two-dimensional array, you should have put an error in the foreach loop.
For example:
$ Row = array ("username" => "admin", "mail" => "admin@admin.com", "id" => "1 "), array ("username" => "uer1", "mail" => "user1@user.com", "id" => "2 "), array ("username" => "uer2", "mail" => "user2@user.com", "id" => "3"); echo"
"; Foreach ($ row as $ key => $ value) {echo"
"; Echo"
| ". $ Value ['id']" | "; Echo"
". $ Value ['username']." | "; Echo"
". $ Value ['id']." | "; Echo"
";} Echo"
"; Style: