Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Space problem.

Status
Not open for further replies.

newbie14

Technical User
Feb 14, 2009
81
MY
Dear All,
I have 2 types of insert into my mysql database. One is the original string which has no problem. The second type if that I will cut and append new value into the original string. Here when I do like this
$routeGeoFenceString = "LINESTRING(".$initialLon." ".$initialLat.",".$array2[0].")";
The space which I put between the $initialLon." ".$initialLat is the one causing problem. Cause the original string when I see from my database is all on one line
LINESTRING(100.91914108115823 4.662998515846695,100.99695964097378 4.481421876277069)
But when this string I put on notepad this how I get problem string cause the it comes on the second line.
LINESTRING(100.99695964097378
4.481421876277069,100.99802356659626 4.48081391877851,100.9994421340929 4.478787393783313)
 
the two strings are completely different. is this just exemplary?

assuming so, i suspect that the issue is in $initialLon. you probably have a line space attached to the end, particularly if you entered the data in a textarea.

you do not need to break in/out of quotes

Code:
$routeGeoFenceString = "LINESTRING($initialLon $initialLat,{$array2[0]})";
 
Dear Jpadie,
Yes both are suppose to be same is just that in the second I am doing the editing. So I want my second one to be the same like the first one.
 
Dear Jpadie,
The problem is still there. The problem I notice that this two value of intitialLat and initialLon is not from a textarea infact I am receiving it just from a database field two. Do you think I must do a kind clean on the to make sure not other space is it ?
 
clean your database. take each item and run it through trim();
 
Dear Jpadie,
Thank you yes your trim method work.Thank you.
 
You can show your appreciation for jpadie's time and effort by clicking on the ' Thank jpadie for this valuable post!' link immediately after one of his posts.

If you want the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Drive a Steam Roller
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top