Forum Moderators: coopster

Message Too Old, No Replies

Trouble with sscanf() in PHP

bad scan conversion character

         

lorax

8:13 pm on Feb 7, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Hola,
Been trying to use sscanf() on a blob field to extract certain chunks of the string. The field contains a string like this "M 808511 224661 L 1073864 365898 L 1045927 820407..." so I'm trying to create arrays based on delineators M, L, and Z.

My code reads

$m = sscanf($geometry["Geometry"], "%p %x %y");

for the Ms. There isn't much documentation on this function and the error doesn't quite make sense - and I've never worked with blob fields before. Some guidance would be appreciated.

jatar_k

8:23 pm on Feb 7, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



sscanf is best used for something that has a standard repeating pattern. Is that what you are working with or does the pattern of the data change?

If it changes you would be better matching it with regex.

lorax

8:43 pm on Feb 7, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Thanks jatar_k,
The pattern is the same but the number of characters does change. I'm beginning to think you're right - I'll try regex instead.