• Top Members
    Reps
    Posts
  • 834 Replies
    2585 Replies
  • 716 Replies
    2025 Replies
  • 331 Replies
    1928 Replies

table help

User avatar
Mark
VIP - Donator
Posts: 370

table help

Tue Sep 01, 2015 3:14 pm

Hello,

Im needing some help please i want my table to displat like this

Mark Mark Mark

but at the moment its going like this

Mark
Mark
Mark

Can anyone help me please this is the code i have for them to go like

Mark
Mark
Mark

Code: Select all

 <?php
            
               $query = mysql_query("SELECT * FROM users WHERE online='1' ORDER BY id DESC LIMIT 5"); 
               $numrows = mysql_num_rows($query); 
                if ($numrows > 0){ 
                echo '<table><tbody>';
                while($row = mysql_fetch_assoc($query)){ 
            $id = $row['id']; 
            $username = $row['username']; 
            $email = $row['email'];
             
            echo "<tr><td><div class=\"noline\"><a href='mailto:$email'>$username</a></div></td></tr>"; 
        } 
        echo '</tbody></table>';
    } 
    else 
        echo "<div class=\"noline\">No users are online!.</div>"; 
  
            
            ?> 

User avatar
Filip
Coding Guru
Posts: 833

Re: table help

Tue Sep 01, 2015 3:22 pm

Code: Select all

 <?php
            
               $query = mysql_query("SELECT * FROM users WHERE online='1' ORDER BY id DESC LIMIT 5"); 
               $numrows = mysql_num_rows($query); 
                if ($numrows > 0){ 
                echo '<table><tbody><tr>';
                while($row = mysql_fetch_assoc($query)){ 
            $id = $row['id']; 
            $username = $row['username']; 
            $email = $row['email'];
             
            echo "<td><div class=\"noline\"><a href='mailto:$email'>$username</a></div></td>"; 
        } 
        echo '</tr></tbody></table>';
    } 
    else 
        echo "<div class=\"noline\">No users are online!.</div>"; 
  
            
            ?> 
CodenStuff wrote:Nope, it's just your sick and dirty mind. You sick twisted warped little pervo :D

User avatar
Mark
VIP - Donator
Posts: 370

Re: table help

Tue Sep 01, 2015 3:32 pm

Hi that worked but is there anyways that i can put only so many per line?

User avatar
Filip
Coding Guru
Posts: 833

Re: table help

Tue Sep 01, 2015 7:17 pm

Hi,

Alternatively you can put each element within a div within a parent and assign parent with class which would have CSS properties as follows:

Code: Select all

.classname div {
display: inline-block;
}
.classname {
white-space: nowrap;
overflow-x: scroll
}
That code would put text in boxes going one after another in one infinitive scrolling parent.

KR,
-Filip
CodenStuff wrote:Nope, it's just your sick and dirty mind. You sick twisted warped little pervo :D

User avatar
Mark
VIP - Donator
Posts: 370

Re: table help

Tue Sep 01, 2015 9:53 pm

hi filip,

do you have an example?

if you look here youll see what i mean

http://yansumkune.com/members.php

User avatar
Filip
Coding Guru
Posts: 833

Re: table help

Wed Sep 02, 2015 6:49 pm

Mark wrote:hi filip,

do you have an example?

if you look here youll see what i mean

http://yansumkune.com/members.php
Hello,

Sorry, I'm currently on a trip and I don't have my laptop with me so I'm not able to do it on live example. I'm coming home on Saturday so I'll be able to do it..

KR,
-Filip
CodenStuff wrote:Nope, it's just your sick and dirty mind. You sick twisted warped little pervo :D

User avatar
CodenStuff
Site Admin
Posts: 4373

Re: table help

Thu Sep 03, 2015 12:13 pm

What do you mean by so many per line?

I can see Filips code limits to 5 results
Welcome to CodenStuff.com Learn Code, Love Code. Thank you for being a member of the community.

Post Reply

Return to “Help & Support”