Forum Moderators: coopster

Message Too Old, No Replies

how to build download link in php

         

plus

5:49 pm on Mar 11, 2009 (gmt 0)

10+ Year Member



Hello. I inserted from form to table in mysql a file. This part of code works. The size of file in table is not zero. Shows 2 MB (picture). But now i want to select some pictures and show on the web page and then you pick link, then shows picture. I wrote code , but i do not knew how to write < a href="?">picture name from table 1</a>

$query = "SELECT id,name FROM upload";
$result = mysql_query($query) or die('bad select');

while(list($id, $pname) = mysql_fetch_array($result))
{
?>
//i do not knew how to build this part ?
<a href="?"><?php=$id;?><?php=$pvardas;?></a> <br>
<?php
}
thanks for any ideas.

andrewsmd

7:17 pm on Mar 13, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Something like this
<?php
$query = "SELECT id,name FROM upload";
$result = mysql_query($query) or die('bad select');

while($row = mysql_fetch_array($result))
{

$tempName = $row['name']'

//im not sure what you really want to do but
echo("<a href=\"{$tempName}\">link</a><br>");

}

?>
Let's start with that I don't understand what php=$id and php=$pvardas are supposed to be. Give me some more detail.