pedmeister Posted March 12, 2007 Share Posted March 12, 2007 I need help displaying the results of the query on the page below in a table please. I can make them display as a text table but not as url's within the table. <? if(isset($_GET['id'])) { include 'library/config.php'; include 'library/opendb.php'; $id = $_GET['id']; $query = "SELECT name, type, size, content FROM upload WHERE id = '$id'"; $result = mysql_query($query) or die('Error, query failed'); list($name, $type, $size, $content) = mysql_fetch_array($result); header("Content-Disposition: attachment; filename=$name"); header("Content-length: $size"); header("Content-type: $type"); echo $content; include 'library/closedb.php'; exit; } ?> <html> <head> <style> .style2 {font-family: "Courier New", Courier, mono} .style3 {font-size: 12px} .style4 {font-size: 18px} </style> <title>Download LTS Files</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body> <div align="center" class="style2"><h2><strong>LTS File Repository</strong></h2></div> <div align="center"><img src="links_2003.jpg"></div> <div align="center" class="style2">Welcome to the online repository for Links2003 LTS files</div> <div align="center" class="style2">Download files below</div> <br> <table> <? include 'library/config.php'; include 'library/opendb.php'; $query = "SELECT id, name FROM upload ORDER BY name"; $result = mysql_query($query) or die('Error, query failed'); if(mysql_num_rows($result) == 0) { echo "Database is empty <br>"; } else { while(list($id, $name) = mysql_fetch_array($result)) { ?> <a href="download.php?id=<?=$name;?>"><?=$name;?></a> <br> <? } } include 'library/closedb.php'; ?> </table> </body> </html> Any help greatly appreciated Peds Link to comment https://forums.phpfreaks.com/topic/42330-displaying-results-in-table-help-needed/ Share on other sites More sharing options...
skali Posted March 12, 2007 Share Posted March 12, 2007 What do you get, any error?? Link to comment https://forums.phpfreaks.com/topic/42330-displaying-results-in-table-help-needed/#findComment-205347 Share on other sites More sharing options...
pedmeister Posted March 12, 2007 Author Share Posted March 12, 2007 What do you get, any error?? Sorry, I just have no idea how to get the results in the table to display as clickable links. I got numerous different Parse Errors while attempting it, so thought it best to ask for help here. Peds Link to comment https://forums.phpfreaks.com/topic/42330-displaying-results-in-table-help-needed/#findComment-205354 Share on other sites More sharing options...
dsaba Posted March 12, 2007 Share Posted March 12, 2007 you can insert resultlinks thats html code into your mysql database that link to a certain result page that way when you query your database or table, you can just display the links as part of your table, straight from your database another way is you can wrap your results in html and make links out of them on the page you are querying them also you can't just make "magic" links or urls out of results, the url has to point somewhere maybe another page that processes the result more and displays more details? think about where you will link results and then you start thinking about linking your results to wherever you want to link them Link to comment https://forums.phpfreaks.com/topic/42330-displaying-results-in-table-help-needed/#findComment-205356 Share on other sites More sharing options...
pedmeister Posted March 12, 2007 Author Share Posted March 12, 2007 you can insert resultlinks thats html code into your mysql database that link to a certain result page that way when you query your database or table, you can just display the links as part of your table, straight from your database another way is you can wrap your results in html and make links out of them on the page you are querying them also you can't just make "magic" links or urls out of results, the url has to point somewhere maybe another page that processes the result more and displays more details? think about where you will link results and then you start thinking about linking your results to wherever you want to link them Ok, I understand the logic thanks. Do I need to change the db table? But, how do I code that? I am new to php/mysql. Thanks Link to comment https://forums.phpfreaks.com/topic/42330-displaying-results-in-table-help-needed/#findComment-205359 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.