SkyRanger Posted April 27, 2007 Share Posted April 27, 2007 I am having a problem when a user type "word" mysql like to cut off everything after the first " how can I make it so mysql will insert the whole like ie: first "word" here instead of cutting off at first? Link to comment https://forums.phpfreaks.com/topic/48943-solved-problem/ Share on other sites More sharing options...
kenrbnsn Posted April 27, 2007 Share Posted April 27, 2007 Please post the code you're using between tags. Ken Link to comment https://forums.phpfreaks.com/topic/48943-solved-problem/#findComment-239797 Share on other sites More sharing options...
taith Posted April 27, 2007 Share Posted April 27, 2007 a) addslashes() b) htmlentities() <-- prolly better for this... Link to comment https://forums.phpfreaks.com/topic/48943-solved-problem/#findComment-239802 Share on other sites More sharing options...
SkyRanger Posted April 27, 2007 Author Share Posted April 27, 2007 Ok this is what is happening. Users are typeing things in text boxes like: From: <input type=\"text\" name=\"fname\"> value = Firstname "Nick" Lastname or To: <input type=\"text\" name=\"tname\"> value = Firstname "Nick" Lastname I tried doing: $fromname = addslashes($fname); and $toname = addslashes($tname); With no luck I honestly do not know how to properly use this code. Doing google search as I type for more info. Link to comment https://forums.phpfreaks.com/topic/48943-solved-problem/#findComment-239811 Share on other sites More sharing options...
taith Posted April 27, 2007 Share Posted April 27, 2007 http://us2.php.net/manual/en/function.htmlentities.php Link to comment https://forums.phpfreaks.com/topic/48943-solved-problem/#findComment-239813 Share on other sites More sharing options...
SkyRanger Posted April 27, 2007 Author Share Posted April 27, 2007 Thanks taith, I am learning alot from that link you gave me, fixed 90% of my problems. Link to comment https://forums.phpfreaks.com/topic/48943-solved-problem/#findComment-239907 Share on other sites More sharing options...
taith Posted April 27, 2007 Share Posted April 27, 2007 LOL! it fixes 90% of user input problems ;-) Link to comment https://forums.phpfreaks.com/topic/48943-solved-problem/#findComment-239919 Share on other sites More sharing options...
SkyRanger Posted April 27, 2007 Author Share Posted April 27, 2007 lol, Just realized I need stripslashes,addslashes and htmlentities() now it works 100%. Thanks for the help. Link to comment https://forums.phpfreaks.com/topic/48943-solved-problem/#findComment-239935 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.