Clearing a page? Refreshing a page, or adding functions to a link?

Discussion in 'PHP' started by jpmad4it, Mar 6, 2008.

  1. #1
    Hi there

    This is a bit of a strange issue, well it is to me being a newbie lol.

    I'll start with my code:

    <?
          $num=3;
          $width=100/$num;
          $cnt=0;
          
          $items="<table border='0' cellpadding='0' cellspacing='0' align='center'><tr>";
          $taa=0;
          
          if(mysql_num_rows($online_sql) > 0) {
              while ($online = mysql_fetch_array($online_sql)) {
                $taa++;
                if ($cnt==$num){
                    $items.="</tr><tr>";
                    $cnt=0;
                }
     
                $items.="<td style='padding-bottom:20px; padding-right:20px;'>
                            <table class='border' bgcolor='#000000'>
                                <tbody>
                                    <tr>
                                        <td style='height:190px;'><a href='".processLink($online["product_id"], $online["name"])."'><img alt='".$online["name"]."' border=0 src='makethumb.php?pic=product_images/".$online["filename"]."&w=122&sq=N' /></a><br /><div align='center'><a href='".processLink($online["product_id"], $online["name"])."'>".$online["name"]."</a>
                                        </td>
                                    </tr>
                            </tbody>
                      </table>
                      </td>";
                 $cnt++;
     
                 $items.="</tr></tbody></table>";
                 print $items;
        }
        } else {
            print "<center>We're sorry, but no one is online </center>";
    }
    ?>
          <?  
            if (!isset($_GET["id"])) $_GET["id"]='';
            if ($_GET["id"]!=''){
            require "profiles.php";
                } else {
                $engine->load(); 
            }
        ?>
    PHP:
    This code is contained in my index.php file. What it does is grab the data from the database to display pictures of people who are online. It also creates a link over the image, which once clicked loads up that persons profile.

    I think that the profile is loaded by this code: $engine->load(); which is shown in the above code. I think it calls a module and essentially includes a PHP file (which holds the profile for the person). The link to the profile is in this format: http://www.mysite.com/JONATHAN,217. I guess that its getting the user name and ID?

    The problem is that the profile is being loaded directly into the index.php file underneath all the images. What I need to do is try to clear the images first, and then load the profile, all within the index.php page, or on a separate page. It just looks a mess when the profile is loaded underneath the images.

    I tried to add some kind of page counter, but realised that wouldn't work. Could I not add the above code to the link that is processed using 'onclick' and call a separate file called user_profile.php? My problem is getting the data into a link format using PHP. Or maybe use the $engine->load(); within the link?

    Or does anyone have any better ideas? I'm sure there must be something else I can do, for example, is there no function to load a php file in the else statement, or redirect to another file?

    Any help would be great.

    kind regards
    Jonathan
     
    jpmad4it, Mar 6, 2008 IP