Page 1 of 1

Substring Question...

Posted: Thu Jan 14, 2010 12:16 pm
by TARCON
I have this image in my database: http://thumbs.forrent.com/imgs/fr/prope ... 000020.jpg

And in my database I have this URL for the image.

Well, where the PHP comes in, to show the image I am taking the subtring of the image of the first 25 characters.

My code is: $subImage = substr($image,0,25) where $image is the URL given...

I want to be getting: "http://thumbs.forrent.com"

But I am getting just a number 1.

Any help would be great...

Re: Substring Question...

Posted: Thu Jan 14, 2010 12:23 pm
by AbraCadaver
Dunno why you're getting 1. echo $image and make sure it's what you think it is. Also, check out parse_url().

Re: Substring Question...

Posted: Thu Jan 14, 2010 12:58 pm
by TARCON
I got it now. It was doing it right in the first place.

When I printed the subImage in a if-statement, it would return 1. If I printed the subImage outside of the statement, it would return the desired result.