$5 to help solve a problem!

Discussion in 'PHP' started by crazyryan, Dec 16, 2006.

  1. #1
    My code is:

    <?php
    require_once ('global.php');
    require_once ('include/class_pagination.php');
    
        $getdetails = "SELECT * FROM `users` ".
                      "WHERE `username` = '" . mysql_real_escape_string(stripslashes(trim($_GET['user']))) . "'";
        $getdetailsresult = mysql_query($getdetails) or die(mysql_error());
        $getdetailscount = mysql_num_rows($getdetailsresult);
        
        if($getdetailscount == 0)
        {
            die('No user found!');
        }
        
        $details = mysql_fetch_array($getdetailsresult);
    
    $title = $details['username'] . "'s profile";
    
    $username = '' .$details['username'] . '';
    $location = '' . $details['location'] . '';
    $interests = '' . $details['interests'] . ''; 
    $about = '' . $details['about'] . '';
    
         $test = $favorites = "SELECT * FROM `favorites` WHERE `user_id` = '" . $details['user_id']. "' ";
        $favoritesresult = mysql_query($favorites) or die(mysql_error());
        
        $favoritescount = mysql_num_rows($favoritesresult);
        
        
        
        while($favorite = mysql_fetch_array($favoritesresult)){
            $getitle = "SELECT `title`, `filename` FROM `files` WHERE `file_id` = '" . $favorite['file_id'] . "'";
            $getitleresult = mysql_query($getitle) or die(mysql_error());
            $titles = mysql_fetch_array($getitleresult);    
            
            echo '<img src="http://www.boredombase.com/thumbnails/' . $titles['filename'] . '.png" /><a href="http://yoursite.com/' . $favorite['file_id'] . '-' . str_replace(' ', '-', strtolower($titles['title'])) . '.html">' . $titles['title'] . '</a><br />';
        }
    
    $tpl->output_page ('profile');
    
    
    ?>
    PHP:
    This shows as: http://www.boredombase.com/profile.php?user=admin

    Basically, $5 to anyone who can make it so them 3 images and text display underneath username/location/etc etc.

    EDIT: I use a template system, so where you see $test =, this allows me to use {test} to show that piece of script..
     
    crazyryan, Dec 16, 2006 IP
  2. krakjoe

    krakjoe Well-Known Member

    Messages:
    1,795
    Likes Received:
    141
    Best Answers:
    0
    Trophy Points:
    135
    #2
    
    <?php
    require_once ('global.php');
    require_once ('include/class_pagination.php');
    
        $getdetails = "SELECT * FROM `users` ".
                      "WHERE `username` = '" . mysql_real_escape_string(stripslashes(trim($_GET['user']))) . "'";
        $getdetailsresult = mysql_query($getdetails) or die(mysql_error());
        $getdetailscount = mysql_num_rows($getdetailsresult);
       
        if($getdetailscount == 0)
        {
            die('No user found!');
        }
       
        $details = mysql_fetch_array($getdetailsresult);
    
    $title = $details['username'] . "'s profile";
    
    $username = '' .$details['username'] . '';
    $location = '' . $details['location'] . '';
    $interests = '' . $details['interests'] . '';
    $about = '' . $details['about'] . '';
    
        $favorites = "SELECT * FROM `favorites` WHERE `user_id` = '" . $details['user_id']. "' ";
        $favoritesresult = mysql_query($favorites) or die(mysql_error());
       
        $favoritescount = mysql_num_rows($favoritesresult);
    
        while($favorite = mysql_fetch_array($favoritesresult)){
            $getitle = "SELECT `title`, `filename` FROM `files` WHERE `file_id` = '" . $favorite['file_id'] . "'";
            $getitleresult = mysql_query($getitle) or die(mysql_error());
            $titles = mysql_fetch_array($getitleresult);   
           
            echo '<img src="http://www.boredombase.com/thumbnails/' . $titles['filename'] . '.png" /><a href="http://yoursite.com/' . $favorite['file_id'] . '-' . str_replace(' ', '-', strtolower($titles['title'])) . '.html">' . $titles['title'] . '</a><br />';
        }
    
    $tpl->output_page ('profile');
    
    
    ?>
    
    PHP:
    try that .....
     
    krakjoe, Dec 16, 2006 IP
  3. crazyryan

    crazyryan Well-Known Member

    Messages:
    3,087
    Likes Received:
    165
    Best Answers:
    0
    Trophy Points:
    175
    #3
    Just tried that joe, didn't work :(
     
    crazyryan, Dec 16, 2006 IP
  4. Barti1987

    Barti1987 Well-Known Member

    Messages:
    2,703
    Likes Received:
    115
    Best Answers:
    0
    Trophy Points:
    185
    #4
    What three images?

    Be more precise.

    Peace,
     
    Barti1987, Dec 17, 2006 IP
  5. ketan9

    ketan9 Active Member

    Messages:
    548
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    58
    #5
    Provide more details, your problem description is a bit vague!!!
     
    ketan9, Dec 20, 2006 IP
  6. crazyryan

    crazyryan Well-Known Member

    Messages:
    3,087
    Likes Received:
    165
    Best Answers:
    0
    Trophy Points:
    175
    #6
    This thread is old and no longer needed, feel free to lock it.
     
    crazyryan, Dec 20, 2006 IP