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 4054684
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T14:36:24+00:00 2026-05-20T14:36:24+00:00

So, I have a database table with the following fields: title , date ,

  • 0

So, I have a database table with the following fields: title, date, text, file1, file2, file3, file4, file5. I use it to store news and occasionally, the title of files related to the news. The problem is that different news have a different number of files, ranging from 0 to 5. Now, how can I post the link to the exact number of files every news contain? I tried something like this but it didn’t work:

$query="SELECT * FROM news WHERE id=1";

$result=mysql_query($query);

while($row=mysql_fetch_array($result))

{

extract($row);

for($i=1;$i<=5;$i++)

    if($"file".$i!="")?>

    <p><a href="/admin/uploads/<?php echo $"file".$i?>"><?php echo $"file".$i?></a></p>

}
  • 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-05-20T14:36:25+00:00Added an answer on May 20, 2026 at 2:36 pm

    I think this is what you want:

    for($i=1;$i<=5;$i++) {
        $sfile = $row["file$i"];
        if($sfile != "") {
    ?>
            <p><a href="/admin/uploads/<?php echo $sfile?>"><?php echo $sfile?></a></p>
    <?php
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have one table called: Transaction. This table has the following fields: (ID,ProductName,Amount,Date) placed
I have a tree-style database with the following structure: Table fields: NodeID int ParentID
I have the following database table created thus: CREATE TABLE AUCTIONS ( ARTICLE_NO VARCHAR(20),
I have the following table relationship in my database: Parent / \ Child1 Child2
I have a database table and one of the fields (not the primary key)
I have a database table (named Topics) which includes these fields : topicId name
In my news page project, I have a database table news with the following
Let's say I have the following simple table variable: declare @databases table ( DatabaseID
I have the following tables in my database that have a many-to-many relationship, which
I have a database table that i want to allow my friends to update.

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.