Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8365725
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T12:43:42+00:00 2026-06-09T12:43:42+00:00

I am trying to create a simple link. The issue is the file name

  • 0

I am trying to create a simple link. The issue is the file name is going to come from the database.

example: <a href="foldername/**FileNameInSQL.zip**">Download</a>

I have not worked much with MYSQL and have pieced together something that is working so far

<?php
$products_id = $_GET['id'];

mysql_connect("localhost", "username", "password") or die(mysql_error()); 

mysql_select_db("database") or die(mysql_error()); 

$sql = "select * from znc_product_extra_fields where products_id = '" . $products_id . "'"; 

$query = mysql_query($sql);

while ($row = mysql_fetch_array($query)) { 
echo $row['file_1']; 
}

?> 

When I run it it does just what I want, it echos the file name that is assigned to that specific row (item number)

But I am lost how to turn this into the link. The only thing I can think is somehow assigning this result to a variable and calling it while creating the link but I do not know how to take this result which is correct and actually use it! How would I take this filename and place in the link

<a href="foldername/**FileNameInSQL.zip**">Download</a>

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T12:43:43+00:00Added an answer on June 9, 2026 at 12:43 pm

    PHP outputs whatever you want it to – text, HTML, XML, etc. So just output the HTML. I think what you want is:

    echo "<a href=\"foldername/".$row['file_1']."\">Download</a>";

    Although you shouldn’t be using the outdated mysql_* functions. Please see PDO (the best option) or mysqli.

    To prevent SQL injection, use PDO::quote (if you are using PDO), or mysqli_real_escape_string (if you are using mysqli).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm studying webrat and cucumber and trying to create simple example. Here is my
I'm trying to create a simple static C++ library that I can link it
I am trying to create an simple link hider to hide external links. I
I am trying to create a simple configuration file that looks like this url
I'm trying to create simple Ajax call, but after clicking the link I get
I am trying to create a simple link in HAML like this: link_to Create
Trying to create a simple noddy example so that I can build my next
I'm trying to create simple script that subscribes a user to a company calendar.
I setup a Paypal Sandbox account and am trying to create simple purchases through
Im trying to create a simple pan and zoom app using silverlight 4, but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.