简体   繁体   中英

how can i print the link of a directory in php?

i ve a word document in my folder, whose name is already inserted in the database.. i want to show the document from the folder via php.. like if someone clicks on the link, the whole document should appear in front end ..

$sql = "SELECT * FROM user WHERE city LIKE '%".$term."%'"; 
$r_query = mysql_query($sql); 

while ($row = mysql_fetch_array($r_query)){  
echo 'fast name: ' .$row['fname'];  
echo '<br /> Resume : '.$row['resume']; 

This will only print the resume name stored in the db .. i want to represent the resume name as a link , after clicking on that it should show the whole document

As suggested you in comment, you need to put folder path in anchor tag.

$path = __DIR__ . "/../resume_folder/";
echo $path;

If $path is correct then write your code as below:-

while ($row = mysql_fetch_array($r_query)){  
  echo 'fast name: ' .$row['fname'];  
  echo "<a href='$path.{$row['resume']}'>Resume</a>";
}

Hope it will help you :)

这样尝试

echo '<br /> <a href = "<?php echo base_url().$row['resume'];?>"> Resume </a>'; 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM