table help

3 posts Page 1 of 1
Contributors
User avatar
Mark
VIP - Donator
VIP - Donator
Posts: 372
Joined: Mon Aug 17, 2009 10:35 pm

table help
Mark
Hello,

How do i put my echo "<a href='#'>$user</a>"; in to a table so it shows my usernames along the way 5 on each line can anyone help please?.

<?php include('styles/top.php'); ?>

<div id="left">

<p>
<?php
require("scripts/connect.php");
$query = mysql_query("SELECT * FROM users WHERE locked='0' AND active='1' ORDER BY id DESC");
$numrows = mysql_num_rows($query);
if ($numrows > 0){
while($row = mysql_fetch_assoc($query)){
$id = $row['id'];
$user = $row['username'];

echo "<a href='#'>$user</a>";
}
}
else
echo "No users were found!.";
?>
</p>

</div>

<?php include('styles/bottom.php'); ?>
http://www.mbappz.com
User avatar
CodenStuff
Site Admin
Site Admin
Posts: 4389
Joined: Tue Aug 04, 2009 1:47 am

Re: table help
CodenStuff
Not tested but I think something like this should output in to a table
Code: Select all
<?php include('styles/top.php'); ?> 

<div id="left"> 

<p> 
<?php 


require("scripts/connect.php"); 
$query = mysql_query("SELECT * FROM users WHERE locked='0' AND active='1' ORDER BY id DESC"); 
$numrows = mysql_num_rows($query); 
if ($numrows > 0){ 
echo "<table>";
while($row = mysql_fetch_assoc($query)){ 
$id = $row['id']; 
$user = $row['username']; 
echo "<tr><td><a href='#'>$user</a></td></tr>";
} 
echo "</table>";
} 
else 
echo "No users were found!."; 
?> 
</p> 

</div> 

<?php include('styles/bottom.php'); ?>
Welcome to CodenStuff.com Learn Code, Love Code. Thank you for being a member of the community.
User avatar
Mark
VIP - Donator
VIP - Donator
Posts: 372
Joined: Mon Aug 17, 2009 10:35 pm

Re: table help
Mark
hi,

I'm trying to use this code on my site. The html keeps given me an error for some reason how can this be sorted?
Code: Select all
<?php include('styles/top.php'); ?> 
         
        <div id="full"> 
              
            <?php  
              
             if ($username){ 
              
                 
            <center><h1>In memory of John Guild Rodger</h1></center>    
             
            <center><img src="./images/john.jpg" alt="John Guild Rodger" height="200" width="200" /><img /></center> 
             
             
            <center><p>The road so far the journey began with founder and cheif instructor John G Rodger taking up kung fu in the early 1970s starting in tay street Dundee with Lau Gar Kuen kung fu and very quickly raising to the ranks of black sash. 
That club closed and left students with no club, John then opened the club in forebank church Dundee for him and students to train, they then studied different styles of martial arts mixing them together to come up with there own style and forms. 
He then met lin ian chang through a mutal friend Tomy long who also studied martial arts, the two had different views and thoughts on the martial arts to the point where on a saturday morning at about half past 9 they met at forebank church hall for open combat to decide which form and style would be more sucessfull my father coming from boxing and kung fu back round and lin ian chang coming from a traditional wing chung backround which was close quarter fighter which my father called phone box fighting and didnt think it would stand up in full contact unarmed combat.
My self being a witness to this contest watched as two grown men went head to head, needless to say my farthers theory was correct him being the victor but him and lin became life long friends and lin teaching my father wing chung and my father teaching him a long range boxing and his style of kung fu thus the two of them coming up with a free style kung fu and chinese kickboxing style to be reckoned with and this was the beginning of Yan Sum Kune Kung fu and chinese kickboxing.</p> </center> 
           
           } 
           else 
                echo "You must be logged in to view this page."; 
           ?> 
                 
        </div> 
         
        <div id="right"> 
         
        </div> 

<?php include('styles/bottom.php'); ?>
http://www.mbappz.com
3 posts Page 1 of 1
Return to “Help & Support”