Rifts Posted July 15, 2010 Share Posted July 15, 2010 When I run this it outputs the data down in a straight line like this name phone email name phone email name phone email but I want to display it like this name name name phone phone phone email email email name name name phone phone phone email email email here is my code im currently using while($row = mysql_fetch_array($result)) { echo "<div style='font-size:15px'>"; echo "<font color='red'>Name:</font>" . " " . $row['name'] . "<br>"; echo "<font color='red'>Number:</font>" . " " . $row['number'] . "<br>"; echo "<font color='red'>Email:</font>" . " " . $row['email'] . "<br>"; echo "<font color='red'>Phone:</font>" . " " . $row['phone'] . "<br>"; echo "<font color='red'>Comments:</font>" . " " . $row['comments'] . "<br>"; echo "<br />"; echo "<br />"; echo "<br />"; echo "</div>"; } thanks Quote Link to comment https://forums.phpfreaks.com/topic/207892-displaying-data-horizontally-not-vertically/ Share on other sites More sharing options...
Pikachu2000 Posted July 15, 2010 Share Posted July 15, 2010 Your query results echo 5 fields, not 3. Do you only want the 3 fields, or do you want all 5? Quote Link to comment https://forums.phpfreaks.com/topic/207892-displaying-data-horizontally-not-vertically/#findComment-1086762 Share on other sites More sharing options...
Zane Posted July 15, 2010 Share Posted July 15, 2010 create a content div, with a width that you can divide equally into three parts (mathematically) using the widths of your data divs. Then for those data divs.. in CSS, give them the float left attribute Quote Link to comment https://forums.phpfreaks.com/topic/207892-displaying-data-horizontally-not-vertically/#findComment-1086764 Share on other sites More sharing options...
Rifts Posted July 15, 2010 Author Share Posted July 15, 2010 oh sorry i only put 3 fields for typing sake but i do want all 5 fields Quote Link to comment https://forums.phpfreaks.com/topic/207892-displaying-data-horizontally-not-vertically/#findComment-1086766 Share on other sites More sharing options...
Rifts Posted July 16, 2010 Author Share Posted July 16, 2010 still looking for help Quote Link to comment https://forums.phpfreaks.com/topic/207892-displaying-data-horizontally-not-vertically/#findComment-1086812 Share on other sites More sharing options...
haku Posted July 16, 2010 Share Posted July 16, 2010 Zanus gave you the answer. And please don't post PHP in the CSS section. Post the HTML output. Quote Link to comment https://forums.phpfreaks.com/topic/207892-displaying-data-horizontally-not-vertically/#findComment-1086827 Share on other sites More sharing options...
Rifts Posted July 16, 2010 Author Share Posted July 16, 2010 I posted this in the PHP section but a mod moved it here... Quote Link to comment https://forums.phpfreaks.com/topic/207892-displaying-data-horizontally-not-vertically/#findComment-1086829 Share on other sites More sharing options...
haku Posted July 16, 2010 Share Posted July 16, 2010 Fair enough then. But zanus gave you the answer still - float your data left. Quote Link to comment https://forums.phpfreaks.com/topic/207892-displaying-data-horizontally-not-vertically/#findComment-1086832 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.