Skelethor Posted April 10, 2006 Share Posted April 10, 2006 This is what I want to do:I have printed out my items of my database in 1 single line.Every row in my database is a new line when it's printed out.Like this:Name, First Name, E-mail, AdresName2, First Name2, E-mail2, Adres2...Now I want to work with the lay-out.Like this:[b]Name First Name E-mail Adres[/b]-------------------------------------------------Mister X 1@mail Street 1Mister Y 2@mail Street2All this in a nice html table with border =1 (all different cells without the line under the headlines)Here's my code:<?php$username="Administrator"; $password="********"; $database="newstravel"; mysql_connect('localhost',$username,$password); mysql_select_db($database); $query = 'INSERT INTO login VALUES("","'.$_POST['txtLoginnaam'].'", "'.$_POST['txtPaswoord'].'", "'.$_POST['txtVoornaam'].'", "'.$_POST['txtNaam'].'", "'.$_POST['txtAdres'].'", "'.$_POST['txtEmail'].'")'; $bInsert = mysql_query($query); if(!$bInsert) { echo 'Fout tijdens invoegen'; } $query="SELECT * FROM login"; $sqlResult=mysql_query($query); while ($aUsers = mysql_fetch_assoc($sqlResult)) { echo ' Loginnaam: '.$aUsers['Loginnaam'].' Paswoord: '.$aUsers['Paswoord'].' Voornaam: '.$aUsers['Voornaam'].' Naam: '.$aUsers['Naam'].' Adres: '.$aUsers['Adres'].' E-mail: '.$aUsers['E-mail']; echo "<br>";} ?> Thx... Quote Link to comment Share on other sites More sharing options...
titangf Posted April 10, 2006 Share Posted April 10, 2006 Try making an incomplete table where the PHP loops the table rows that you want to display...I'm will admit that this code might not work... but its the general idea that you want to build on [code]<?php while ($aUsers = mysql_fetch_assoc($sqlResult)) {?> <tr class="td"> <td><?php echo $aUsers['Naam']; ?></td> <td><?php echo $aUsers['Adres']; ?></td> <td><?php echo $aUsers['E-mail']; ?></td> </tr><?php }?>[/code]Hope that this helps and if it works... woot! Solved one problem, good luck. 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.