MADTinus Posted February 27, 2015 Share Posted February 27, 2015 (edited) Hello there, I've made a very simple file to put some requested data in a tabel-form. Somehow first the output starts with about 60-70 blank lines, and then the output. Somewere I made a mistake, but the longer I look, the harder it get tot see. Please can someone show me the mistake. See below/ Thanks, Martin. Programlines: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Output data from Complex</title> </head> <?php # MRouw: deze file maakt de connectie met de database require ('connectdb.php'); // MRouw: hier haal je de gewenste velden op uit de gewenste tabel $sql = "SELECT Complexnaam, Adres, Plaats FROM complex"; $result = $conn->query($sql); # Heater-row echo "<table border=2 cellpadding=0 cellspacing=0>"; echo "<td><b>Complexnaam</b></td><td><b>Adres</b></td><td><b>Plaats</b></td>"; while($row = $result->fetch_assoc()) { echo ' <tr> <td>' . $row['Complexnaam'] . '</td> <td>' . $row['Adres'] . '</td> <td>' . $row['Plaats'] . '</td> </tr> <br> '; ; } $conn->close(); ?> Edited February 27, 2015 by MADTinus Quote Link to comment Share on other sites More sharing options...
Solution ginerjm Posted February 27, 2015 Solution Share Posted February 27, 2015 You are seeing all the <br> tags echoed out first because you inserted them inside an html table. You can't do that. This code: <td>' . $row['Plaats'] . '</td> </tr> <br> THIS IS BAD '; ; THIS IS NOT NEEDED } should be changed to remove the <br> and the EXTRA ; line. <td>' . $row['Plaats'] . '</td> </tr> '; } Quote Link to comment Share on other sites More sharing options...
MADTinus Posted February 27, 2015 Author Share Posted February 27, 2015 Thank you very mutch, this was the mistake. Now my code works. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.