Adding to a string in PHP????

Status
Not open for further replies.

ziycon

New Member
I have the below code and want to add '../' just before the link, how can i do this, i've tried string replace but no luck!??
The whole link is in a string before being saved to the DB.

What i have:
Code:
<img src="images/image1.jpg"/>

What i want:
Code:
<img src="../images/image1.jpg"/>
 

louie

New Member
did you try:
PHP:
$str = str_replace('<img src="images','<img src="../images',$str);
 

louie

New Member
it shouldn't as str_replace is very good at doing this kind of job.

show us the code, you are probably missing something.
 

ziycon

New Member
I got it, the code i was using and the code you game me was fine, i just had 2 characters reversed in a variable name!
I feel so stupid!:D
 
Status
Not open for further replies.
Top