[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

How to set different filename in one row in database

Posted on 2008-06-10
1
Medium Priority
?
188 Views
Last Modified: 2013-12-13
PHP

i have a table, i call it GETFILENAME
in GETFILENAME i have 2 field one call "description" and another one call "filename"
in filename i have 3 record called "test1","test2","test3"
this "test1","test2","test3" is a file-name.


if writing in PHP i can write
$file1 = test1;
$file2 = test2;
$file3 = test3;

and each file is differentiate by different variable name

but

in the database i only have one field called filename and this filename is the variable name for that 3 record
as this

$GetFileNameReturn[$j] = $row['filename'];
foreach($this->GetFileNameReturn as $FileName)
    {      
    $filename = test1;
    $filename = test2;
    $filename = test3;
    }

above code shows 3 different file are assigned to the same variable filename
suppose i only need 3 times to create 3 different file but now i need 9 time to create 3 different file
How to do this
pls help











0
Comment
Question by:firekiller15
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 5

Accepted Solution

by:
allmer earned 1000 total points
ID: 21757357
Not knowing anything about what you are trying to do let me give just a very small advice.
Either loop through the files you get from the database directly
and perform whatever you need to do directly
or
Use an array which will contain your filenames (see snippet).
If you need to know additional information about your files to decide what
to do with them you may want to store that in the DB as well e.g.: FileType (txt,jpg,..)
Hope this helps
$index = 0;
$filename = array(); //Not really neccessary
foreach($this->GetFileNameReturn as $FileName)
{      
    $filename[$index++] = $FileName;
}
//Now all files are stored in the $filename array and you can 
//access them by their indices.

Open in new window

0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
This article discusses four methods for overlaying images in a container on a web page
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question