Jump to content

[SOLVED] problem with spaces


Canman2005

Recommended Posts

Hi all

 

I have a simple sql statement that pulls a list of files from a sql table, I then print the name of each filename using

print $rows[filename];

 

This works fine, unless a filename has a spae in it and then it reads everything up to the space.

 

For example, a filename which prints ok looks like

 

image1.jpg

 

but if there is a space for example

 

image 1.jpg

 

then it prints

 

image

 

and forgets everything after the space.

 

Is there a fix for this?

 

Thanks

 

Dave

Link to comment
https://forums.phpfreaks.com/topic/42411-solved-problem-with-spaces/
Share on other sites

Hi

 

My code looks like

 

if ($rows[type] == 'application/pdf' || $rows[type] == 'text/plain')
	{
		print '<p style=margin-top:5px><strong><a href=file_uploads/'.$rows[filename].' target=_blank>View \ Download File</a></strong></p>';

	}

 

So if a filename has a space in it, then it ignore everything after the space

 

Does that help?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.