Results 1 to 5 of 5

Thread: [RESOLVED] Will not display results correctly, need help

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jan 2006
    Posts
    247

    Resolved [RESOLVED] Will not display results correctly, need help

    I have been working on a script long enough to decide that I am now officially frustrated. For some reason this chunk of the script will not display things properly...either it leaves off results, does not display proper URLs, or it leaves off links.

    I don't know why and I can not figure it out, if anyone can help that'd be greatly appreciated.

    PHP Code:
    elseif ($do == "list")
    {
        
    $artist_name $_POST['artist_name'];
        
    $query "SELECT * FROM Assigns WHERE Username='" $artist_name "'";    
        
    $resulta mysql_query($query);
        
    $num mysql_num_rows($result);
        
    $xn 0;
        
        while (
    $x mysql_fetch_array($resulta))
        {    
            echo 
    "<strong>" $x['File Name'] . "</strong><br /><a href=" "uploads/" $artist_name "/" $x['Directory'] . "/" $x['File Name'] . ">Download This Model</a>";
            
            if (
    $x['HasImage'] == yes)
            {
                
    $query_images "SELECT * FROM Images WHERE Username='" $artist_name "' AND Directory='" mysql_result($result$x"Directory") . "'";
                
    $result_images mysql_query($query_images);
                
                echo 
    "<br /><a href=" "uploads/" $artist_name "/" $x['Directory'] . "/" mysql_result($result_images$xn"Image Assigned") . ">View Image</a><hr>";
            }
            else
            {
                echo 
    "<hr>";
            }
            
            
    $x++;
            
    $xn++;
        }




  2. #2
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906

    Re: Will not display results correctly, need help

    What does it do? And why is the echo statement being used to output HTML? - that is a slapable offence.
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jan 2006
    Posts
    247

    Re: Will not display results correctly, need help

    This creates a dynamic html page where artists (on a game dev team) can download each other's models and view screenshots of the models they are downloading.

    Also, the reason it is outputting HTML is becuase I didn't want to deal with parenthesis at the time. It will probably be changed.

    This page is not really open to the public, just to certain people.



  4. #4
    PowerPoster
    Join Date
    Sep 2003
    Location
    Edmonton, AB, Canada
    Posts
    2,629

    Re: Will not display results correctly, need help

    the reason you aren't getting proper URLs is most likely because you're using terrible markup.

    considering you're sloppy enough to use spaces in a table's field names (or at least, I personally consider that sloppy!), I assume your $artist_name variable might also contain spaces, along with your directory -- and maybe even the file name. if you're creating a hyperlink, you must enclose strings that have spaces in them with quotations; otherwise, the browser doesn't know if you're trying to continue your URL, or add more parameters. if you have no idea what I mean, then take a quick look at this example:

    PHP Code:
    <a href="http://domain.com/this is a link with spaces/file name with spaces.gif">this is a link with spaces -- it will work correctly.</a>

    /*
      the above will link to the following URL, just like you wanted:
      http://domain.com/this is a link with spaces/file name with spaces.gif
    */

    <a href=http://domain.com/this is a link with spaces/file name with spaces.gif>this is a link with spaces. it will NOT work!</a>

    /*
      the above will link to the following URL, which is NOT what you wanted:
      http://domain.com/this
    */ 
    quick edit: why are you incrementing "$x"? $x is a database result. you can't increment it.
    Last edited by kows; Mar 31st, 2007 at 06:14 PM.

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Jan 2006
    Posts
    247

    Re: Will not display results correctly, need help

    All my problems were solved, thanks for helping you guys!



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width