Am running a sql query with php to retrieve some data from mysql database.
Everything works well except that, if the data contains symbols like < and >, then whatever data present between these symbols doesnt show in the output.
for example, if the data is something like “<hello there> how are you?” then only “how are you?” is shown.
But when i run the query directly, it shows me everything without missing anything.
I have done this before, but I cannot remember on the top of my head as what exactly I did. And google is not helping me today, slow day for me…. 🙁
You should escape your databse response properly using
htmlentities().phpMyAdmin does the escaping for you, but it’s your responsibility to escape text for HTML in your application.