Reputation: 49
I have two columns with different values:
And I need to echo those two values into one column, like that:
Printing method:
if($result->num_rows > 0) {
while($row = mysqli_fetch_assoc($result)) {
echo '<tr>
<td scope="row">' . $row["id"].'</td>
<td>' . $row["data"] .'</td>
<td>' . $row["ip"] .'</td>
</tr>';
}
}
Any suggestions on how I could do that?
Upvotes: 1
Views: 37
Reputation: 94662
Do you mean like this
echo '<tr>
<td scope="row">' . $row["id"].'</td>
<td>' . $row["data"] . '(' . $row["ip"] . ')</td>
</tr>';
Upvotes: 1
Reputation: 25351
Merge the two cells:
<td>' . $row["data"] .'</td>
<td>' . $row["ip"] .'</td>
Into one:
<td>' . $row["data"] . '(' . $row["ip"] . ')</td>
Upvotes: 0