|
-
Mar 31st, 2007, 03:08 PM
#1
Thread Starter
Addicted Member
[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++;
}
}
-
Mar 31st, 2007, 03:59 PM
#2
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.
-
Mar 31st, 2007, 04:03 PM
#3
Thread Starter
Addicted Member
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.
-
Mar 31st, 2007, 06:11 PM
#4
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.
-
Mar 31st, 2007, 11:42 PM
#5
Thread Starter
Addicted Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|