Page 1 of 1

table help

Posted: Tue Sep 01, 2015 2:14 pm
by Mark
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>"; 
  
            
            ?> 

Re: table help

Posted: Tue Sep 01, 2015 2:22 pm
by Filip
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>"; 
  
            
            ?> 

Re: table help

Posted: Tue Sep 01, 2015 2:32 pm
by Mark
Hi that worked but is there anyways that i can put only so many per line?

Re: table help

Posted: Tue Sep 01, 2015 6:17 pm
by Filip
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

Re: table help

Posted: Tue Sep 01, 2015 8:53 pm
by Mark
hi filip,

do you have an example?

if you look here youll see what i mean

http://yansumkune.com/members.php

Re: table help

Posted: Wed Sep 02, 2015 5:49 pm
by Filip
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

Re: table help

Posted: Thu Sep 03, 2015 11:13 am
by CodenStuff
What do you mean by so many per line?

I can see Filips code limits to 5 results