SUNIL16 Posted January 25, 2009 Share Posted January 25, 2009 Hi Friends, i am doing career related project in my institute.. i am making one forum where you can post some source codes of .net, java, php, html etc.. this is how i created my database table. mysql_query("CREATE TABLE `questions` ( `qid` int(5) NOT NULL auto_increment, `question` varchar(255) NOT NULL default'0', `answer` longtext NOT NULL, `name` varchar(65) NOT NULL default '0', `datetime` varchar(25) NOT NULL default'0', `view` int(5) NOT NULL default '0', `reply` int(4) NOT NULL default '0', PRIMARY KEY (`qid`) ) TYPE=MyISAM AUTO_INCREMENT=1 "); now if u send any text its taking. but if i send some code of php or html or some other its not showing correctly. so i want to know how to ignore this code while inserting in database. means i want to store as it is and retrieve back as it is. means if some one sends a html code like this in form <table class="main_text" border="1" cellpadding="5" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber1"> or if some one sends php code in form like this <?php echo"sunilkumar"; ?> it has to store as it is and retrieve back same. please help. Quote Link to comment Share on other sites More sharing options...
landavia Posted January 25, 2009 Share Posted January 25, 2009 you might consider to use well htmlentities($str); ex: <?php $str='<table class="main_text" border="1" cellpadding="5" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber1">'; print htmlentities($str); ?> tell me.. what the output ! Quote Link to comment Share on other sites More sharing options...
SUNIL16 Posted January 26, 2009 Author Share Posted January 26, 2009 ya the output is coming as i send.. thanks landavia Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.