将行添加到另一行

I am trying to get the firstname and lastname rows together in one row. This is the code I have so far ,

$sql = "SELECT firstname, lastname, phone, department FROM tl_member ORDER BY firstname LIMIT 29";
$result = $conn->query($sql);

if ($result->num_rows > 0) {
    echo "<table><tr><br><hr><th align='left'>Naam</th><th align='left'>telefoon<th align='left'>phone</th><th>afdeling</tr>";
// output data in rows
  while($row = $result->fetch_assoc()) {
           echo "<tr><td>" .$row["firstname"]."</td><td>" .$row["lastname"]."</td><td>" .$row["phone"]."</td><td>" .$row["department"]."</tr>";
    }               
echo "</table>";
} else {
echo "0 results";
} 

the firstname and lastname are now shows seperatly I want them to be together as one ?

Almost there! You just needed to place first name and second name in the same td

echo "<tr><td>" . $row["firstname"] . " " . $row["lastname"] . "</td><td>" . $row["phone"] . "</td><td>" . $row["department"] . "</tr>";

I think you mean this:

$sql = "SELECT firstname, lastname, phone, department FROM tl_member ORDER BY firstname LIMIT 29";
$result = $conn->query($sql);

if ($result->num_rows > 0) {
    echo "<table><tr><br><hr><th align='left'>Naam</th><th align='left'>telefoon<th align='left'>phone</th><th>afdeling</tr>";
// output data in rows
  while($row = $result->fetch_assoc()) {
           echo "<tr><td>" .$row["firstname"]." " .$row["lastname"]."</td><td>" .$row["phone"]."</td><td>" .$row["department"]."</tr>";
    }               
echo "</table>";
} else {
echo "0 results";
} 

Huum..

Like that ?

$sql = "SELECT firstname, lastname, phone, department FROM tl_member ORDER BY firstname LIMIT 29";
$result = $conn->query($sql);

if ($result->num_rows > 0) {
echo "<table><tr><br><hr><th align='left'>Naam</th><th align='left'>telefoon<th  align='left'>phone</th><th>afdeling</tr>";
// output data in rows
while($row = $result->fetch_assoc()) {
       echo "<tr><td>" .$row["firstname"]." ".$row["lastname"]."</td><td>" .$row["phone"]."</td><td>" .$row["department"]."</tr>";
}               
echo "</table>";
} else {
echo "0 results";
} 

I believe you mean in the same row/cell? Like this?

while($row = $result->fetch_assoc()) {
    echo "<tr><td>" .$row["firstname"] . $row["lastname"]."</td><td>" .$row["phone"]."</td>
    <td>".$row["department"]."</tr>";
}

write the query in this manner :

$sql = "SELECT firstname, lastname, phone, department,concat(firstname,'',lastname) fullname FROM tl_member ORDER BY firstname LIMIT 29";
$result = $conn->query($sql);

to get fullname you need to use: $row["fullname"]