Jump to content

Displaying Files


EPCtech

Recommended Posts

Hello,

I am working on a game submission system for my website, En-Psyche, and I want it to display the files uploaded by the user for them to choose for their game.

 

$sql=mysql_query("SELECT file FROM myfiles WHERE file LIKE '%.png' OR file LIKE '%.gif' OR file LIKE '%.jpg'");
list($file)=mysql_fetch_array($sql);
$sql=mysql_query("SELECT * FROM myfiles WHERE file LIKE '%.zip' OR file LIKE '%.exe' OR file LIKE '%.gmk' OR file LIKE '%.gm6' OR file LIKE '%.gmd' OR file LIKE '%.rar' OR file LIKE '%.zip' AND user='".$name."'");
list($files)=mysql_fetch_array($sql);

$name has already been set. Now, when it echo's the variable, it only echo's the first result. How can I make it echo all the results.

 

Best Regards,

En-Psyche Management

Link to comment
https://forums.phpfreaks.com/topic/121330-displaying-files/
Share on other sites

No, it loops through each row of the result set.

$sql=mysql_query("SELECT * FROM myfiles WHERE file LIKE '%.zip' OR file LIKE '%.exe' OR file LIKE '%.gmk' OR file LIKE '%.gm6' OR file LIKE '%.gmd' OR file LIKE '%.rar' OR file LIKE '%.zip'");
		while($row = mysql_fetch_assoc($sql)){ $files=$row['file'];
		echo("Select stuff...Options...");
		//SELECT * FROM games WHERE keywords LIKE "%really fun%" OR name LIKE "%ff%"
		}

I get: (Oh, wait, you need to be logged in for this...hmm...)

http://www.en-psyche.com/usercp?act=games&sect=postgame

 

Sorry, I'll quickly make a test account.

 

Username: "PHPFreaks"

Password: "phpafterall"

 

Thanks for any help. :)

Link to comment
https://forums.phpfreaks.com/topic/121330-displaying-files/#findComment-625568
Share on other sites

         
             $sql=mysql_query("SELECT * FROM myfiles WHERE file LIKE '%.zip' OR file LIKE '%.exe' OR file LIKE '%.gmk' OR file LIKE '%.gm6' OR file LIKE '%.gmd' OR file LIKE '%.rar' OR file LIKE '%.zip'");
         while(list($file) = mysql_fetch_assoc($sql)){
             echo $file . "<br />";
         }

Link to comment
https://forums.phpfreaks.com/topic/121330-displaying-files/#findComment-625569
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.