psimation
asked on
Strip characters from right of string
Hi
I have entries in a mysql table that I read out, and then display on a page. The entries are the names of images, but some contain spaces in the name, eg. Image 234.jpg
What happens now is that I do this:
...
$pict = $myrow["picture"];
if($pict) {
$picture = trim($pict);
$picture = rawurlencode($picture);
// $picture = rtrim($picture, "%5C%22");
}
...
For some reason, when I look at the source of the resulting page, there are "%5C%22" added to the end of the image name in the SRC line, causing the image not to be displayed.
As you can see, I tried an rtrim specifying these characters, but it does not remove them...
Any ideas?
I have entries in a mysql table that I read out, and then display on a page. The entries are the names of images, but some contain spaces in the name, eg. Image 234.jpg
What happens now is that I do this:
...
$pict = $myrow["picture"];
if($pict) {
$picture = trim($pict);
$picture = rawurlencode($picture);
// $picture = rtrim($picture, "%5C%22");
}
...
For some reason, when I look at the source of the resulting page, there are "%5C%22" added to the end of the image name in the SRC line, causing the image not to be displayed.
As you can see, I tried an rtrim specifying these characters, but it does not remove them...
Any ideas?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.