View Single Post
Old 02-14-2008, 01:05 AM   #7 (permalink)
Orc
The Prestige
 
Orc's Avatar
 
Join Date: Dec 2007
Posts: 1,044
Thanks: 193
Orc is on a distinguished road
Default

Quote:
Originally Posted by Alan @ CIT View Post
Using the examples above, you'd end up with an array of the file paths that you could pattern match / output as you wished.

For example, say your files field in your database contained:

Code:
/home/www/images/file1.png|/home/www/images/file2.jpg|/home/www/images/file3.gif
You would then select that field from your database and use something like:

PHP Code:
$filePaths explode('|'$result['filepaths']); 
The $filePaths variable would then contain an array that looked something like:

PHP Code:
// [0] => '/home/www/images/file1.png'
// [1] => '/home/www/images/file2.jpg'
// [2] => '/home/www/images/file3.gif' 
Which you could then manipulate as you wished.

To re-serialize the data, just use the implode() function.

Alan
Oh thanks! I've never really tried explode, so I wouldn't know if that happened or not. I just thought when it exploded it did this:
PHP Code:
[0] => '/home/www/images/file1.png/home/www/images/file2.jpg/home/www/images/file3.gif' 
Thanks for clearing that up :D
__________________
VillageIdiot can have my babbies ;d
Orc is offline  
Reply With Quote