0

Hi

I am creating some files of which are taken from database fields, the problem is the field in the database has £ in which is great as it is needed when in the browser page. The problem I have is when making the file is that it creates the newfile name as £ in the url rather than £. How do i replace PART of the field ['nightmare'] to make £ rather than $pound; please.

The line with the problem is

$newfile = ''. $file['whatever'].'/'. $file['whatever'].'-'. str_replace(' ','-',trim($file['nightmare'])) . '.php';

Thanks for any help

2
Contributors
3
Replies
4
Views
4 Years
Discussion Span
Last Post by mpc123
0

The problem I have is when making the file is that it creates the newfile name as £ in the url rather than £. How do i replace PART of the field ['nightmare'] to make £ rather than $pound; please.

I'm bit a confused. You want someone to fixed that 1 line but never mention what is $file['whatever'] or $file['nightmare']?

Can you post a little more code? Right now it's just guessing.

0

Hi, firstly thanks for offering help. Basically i need to know how to do 2x string replace on the nightmare file, currently I have one in at the moment replacing space with a dash but how would I do 2 replaces please

Thanks

0

HI I managed to sort it by using arrays with the string replace
For anyone else who would need it

$old = array(' ', '£');
$new = array('-', '£');

$newfile = ''. $file['whatever'].'/'. $file['whatever'].'-'. str_replace($old,$new,trim($file['nightmare'])) . '.php';

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.