Jump to content

Clearing a page, refresh a page's content? Adding functions to a link


jpmad4it

Recommended Posts

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(); 
        }
    ?>

 

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.