logo-dw

Go Back   Dreamweaver Club Forums > Hand Coders Forum > PHP
Register FAQ Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Display Modes
Old 02-06-2010, 06:09 PM   #1
deafboyzaudio
 
Join Date: Jul 2009
Location: west coast, U.S.A.
Posts: 176
Default why does this str_replace not work?

this doesnt work and i cant figure out why....

EXAMPLE:

$uploaded_thumbs_array = Array ([0] => t_Desert Landscape_1.jpg )
Code:
foreach($uploaded_thumbs_array as $uploaded_thumbs){
        str_replace(' ', '_', $uploaded_thumbs);
    }
    print_r($uploaded_thumbs_array);
the print_r($uploaded_thumbs_array); returns
Code:
Array ([0] => t_Desert Landscape_1.jpg )
THe DAMN spaces are still there.... WHY???????
deafboyzaudio is offline   Reply With Quote
Old 02-07-2010, 07:40 PM   #2
tux
tux's Avatar
 
Join Date: Feb 2007
Location: Isle of Wight, that little island right at the bottom of the UK
Posts: 657
Default

PHP Code:
<?php

$uploaded_thumbs_array 
= array(=> 't_Desert Landscape_1.jpg'=> 't_Desert Landscape_2.jpg'=> 't_Desert Landscape_3.jpg');

foreach(
$uploaded_thumbs_array as $uploaded_thumbs){
$uploaded_thumbs =        str_replace(" ""_"$uploaded_thumbs);

echo 
$uploaded_thumbs."<br>";
}
?>
will output......

t_Desert_Landscape_1.jpg
t_Desert_Landscape_2.jpg
t_Desert_Landscape_3.jpg
tux is offline   Reply With Quote
Old 02-09-2010, 01:12 AM   #3
deafboyzaudio
 
Join Date: Jul 2009
Location: west coast, U.S.A.
Posts: 176
Default

Thats what I forgot, I forgot the
Code:
$uploaded_thumbs =
part in the loop. I assumed that it was implied that thats what I wanted since thats what was in the loop, but I guess not.... Thanks man!!!!

Oh, since im talkin to ya, that upload/insert behavior that you helped me with a couple weeks ago... you were right, I was making it too complicated... I had an idea of itweaking a php pagination script to do the same thing since that really all it is... stepping though the images one at a time, page by page and insering info into the DB for each...

My app runs much smoother/quicker now and you can actually use the back button!!!!
deafboyzaudio is offline   Reply With Quote
Old 02-09-2010, 05:54 AM   #4
tux
tux's Avatar
 
Join Date: Feb 2007
Location: Isle of Wight, that little island right at the bottom of the UK
Posts: 657
Default

No probs mate, glad to help.
tux is offline   Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 01:14 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2018, vBulletin Solutions, Inc.
Copyright 2006 DreamweaverClub.com