I have a postgres table with a column (called id) which contains strings. In most cases the strings include a dollar character like <sdfjkdsaf$test@com>.
I’m using PDO statements in a php script to fetch the relevant rows and columns of this table including the above described id-column.
But when I try to use the value from the id-column the PDO result for such an id seems to be empty.
Example:
Expected result: "id":"<sdfjkdsaf$test@com>", "body":"This is a test", ...
Real result: "id":"","body":"This is a test", ...
I guess the reason is that php interprets the dollar character in the string as the beginning of a variable.
Is there any possibility to manipulate the PDO result so that I can use strings containing $ ?
It’s most likely not the dollar character, but the triangular brackets (
<>). See the source code on your page to see them.You can use
htmlentities()to change it into a HTML compliant version. (< >)