Artworkz Artworkz - 1 year ago 86
PHP Question

output values between ' and a ,

I need a special form style of values written.
From ( my write function of mysql querie data fields.
i need these valiues between '(clip) and ,(comma) to seperate them for reading them for a geocode location.

fwrite($file, $tier['latitude'].','.$tier['longitude']."\r\n");

to this result (attention to the commas and clips-

'value1' , 'value2'

but i cant get it allways syntax error
thank you very much i someone give a hint

Answer Source
fwrite($file, '$tier['latitude']'.','.'$tier['longitude']');

This one is not correct, because you are opening simple-quote (') but you are closing it after $tier[ and you are not concatenating latitude, PHP thinks latitude is a variable and you are not using dot (.) to concatenate it. See in my example the difference in colors, the same is PHP interpreting, thats why is giving you error.

Try this one

fwrite($file, "'".$tier['latitude']."', '".$tier['longitude']."'\r\n");

Do you see the difference ? Let me know if it's working for you but you need other output.