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

Recommended Answers

All 3 Replies

Member Avatar for LastMitch

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.

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

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';

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.