View Single Post
Old 08-28-2004, 07:24 PM   #1 (permalink)
xtrax_22
Registered User
 
xtrax_22's Avatar
 
Join Date: Aug 2004
Posts: 8
xtrax_22 is on a distinguished road
Making a dynamic Table cell

Ok what it is l got this mod that users can upload there photo to there account ..

And what this does is it grabse there photo and displays it in a 3 cell column and then it just randomly adds new ones as required..

How you ask l already got it set up for the function and it works great the user can only upload on of 2 file formates GIF and JPEG..
which you can see in the function between table and this is where the tricky part came in..

It will only show the picture of the users that are currently logged in to there account.. which is perfect for us as we already have the other page to display all the members who have added a picture..

The problem is the tables l tried to add around my code is throwing a parser error

ERROR
Parse error: parse error in /home/virtual/site13/fst/var/www/html/tes1t.php on line 41

Here is what l got so far ..
PHP Code:
<?php  
include("header.php");  
$index 0;    
//require_once("mainfile.php");    
$module_name basename(dirname(__FILE__));    
function 
who_online() {   
    global 
$prefix$db;   
     
$sql "SELECT uname, guest FROM ".$prefix."_session WHERE guest = 0";   
     
$result $db->sql_query($sql);   
     
$member_online_num $db->sql_numrows($result);   
     
$who_online_now "";   
     
$i 1
OpenTable();  
$count 0;  
echo 
"<table border=\"1\" cellspacing=\"10\" cellpadding=\"10\">";    
     while(
$session $db->sql_fetchrow($result)) {   
         if(isset(
$session["guest"]) and $session["guest"] == 0) {   
               
$sql ="select user_id from ".$prefix."_users where username='$session[uname]'"
               list(
$user_id) = mysql_fetch_row(mysql_query($sql)); 
               
$count++;   
               if(
$count == 1) { echo "<tr>"; }   
               if(
file_exists("/home/virtual/site13/fst/var/www/html/modules/Photo/memberphotos/$user_id.jpg")) { 
                    
$who_online_now .= "<TD><center><A HREF=\"modules.php?name=Your_Account&amp;op=userinfo&amp;username=$session[uname]\"><img src=\"modules/Photo/memberphotos/$user_id.jpg\" border=\"0\" alt=\"$session[uname]\"><br>$session[uname]</center></TD></a>\n";
                    if(
$count == 3)   { echo "</tr>"; }   
                    if(
$count == 3)   { $count 0; }   
                    } 
                   }
                  }  
if(
$count == 1) { echo "<td>&nbsp;</td><td>&nbsp;</td></tr>"; }
if(
$count == 2) { echo "<td>&nbsp;</td></tr>"; } 
echo 
"</table>"
                    
$count++;   
                    if(
$count == 1) { echo "<tr>"; }       
                    
$i++; 
               }elseif(
file_exists("/home/virtual/site13/fst/var/www/html/modules/Photo/memberphotos/$user_id.gif")) { 
                    
$who_online_now .= "<TD><center><A HREF=\"modules.php?name=Your_Account&amp;op=userinfo&amp;username=$session[uname]\"><img src=\"modules/Photo/memberphotos/$user_id.gif\" border=\"0\" alt=\"$session[uname]\"><br>$session[uname]</center></TD></a>\n";
                    if(
$count == 3)   { echo "</tr>"; }   
                    if(
$count == 3)   { $count 0; }   
                    } 
                   }
                  }  
if(
$count == 1) { echo "<td>&nbsp;</td><td>&nbsp;</td></tr>"; }
if(
$count == 2) { echo "<td>&nbsp;</td></tr>"; } 
echo 
"</table>"
$i++; 
               } 
          }   
     }   
     return 
$who_online_now;   
}  
$some_stuff who_online();  
echo 
"$some_stuff"
CloseTable();
include(
"footer.php");  
}
?>
I appreciate your help greatly as its been paining me for a week or 2 now..

XtraX

Last edited by bdl; 08-28-2004 at 07:51 PM.
xtrax_22 is offline   Reply With Quote