Solved

How to set different filename in one row in database

Posted on 2008-06-10
1
186 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 250 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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to dynamically set the form action using jQuery.

690 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