When I insert "<b>dog</b>" into database using php, it inserts empty string.
How to fix it?
thnx in advance
ok... actually I knew that it is html entity, but the problem is how to save such converted string in database?
Say user makes new post and the post is "<b>dog</b>", so my script as usual is gonna save it in db, but it saves "".
i tried this query , is working for me:
insert into `test` values('<b>dog</b>');
or else post your query.
when i do it directly with phpMyAdmin or console, the insertion is ok, however when via php it inserts nothing...
ya, then please post post your query,
it may be because of quotes in your query.
this code works for me:
<?php $str='<b>dog</b>'; $str=htmlentities($str); echo $q="insert into test values('$str')"; ?>
I think I've found the problem but haven't found the solution yet: problem comes from the root - $_POST. If text sent from client is "<b>dog</b>", then $_POST is empty, that's why php was inserting empty string. But if normal text is sent from client everything goes ok...