M.O.S. Studios Posted January 19, 2009 Share Posted January 19, 2009 hey guys, im placing all my values into a db with addslashes() around the values, now i want to pull the values and have stripslashes around the valules, the problem is im pulling the values using list(), like this $populate=mysql_query("SELECT * FROM `ppinfo` WHERE `index`=".$_POST['index']); list($index, $name, $sig, $user, $pass, $account, $url, $live) = mysql_fetch_array($populate); is there any way to have list remove the slashes or do i have to redefine each var one by one?? thanks in advance Quote Link to comment https://forums.phpfreaks.com/topic/141469-solved-list-and-stripslashes/ Share on other sites More sharing options...
JonnoTheDev Posted January 19, 2009 Share Posted January 19, 2009 each variable Quote Link to comment https://forums.phpfreaks.com/topic/141469-solved-list-and-stripslashes/#findComment-740504 Share on other sites More sharing options...
M.O.S. Studios Posted January 19, 2009 Author Share Posted January 19, 2009 thats sucks!! but thanks for the advice Quote Link to comment https://forums.phpfreaks.com/topic/141469-solved-list-and-stripslashes/#findComment-740505 Share on other sites More sharing options...
JonnoTheDev Posted January 19, 2009 Share Posted January 19, 2009 Also I wouldn't use addslashes in the first place. Escape data before insertion using mysql_real_escape_string(). Then you dont need stripslashes() Quote Link to comment https://forums.phpfreaks.com/topic/141469-solved-list-and-stripslashes/#findComment-740507 Share on other sites More sharing options...
M.O.S. Studios Posted January 19, 2009 Author Share Posted January 19, 2009 is there any difference between mysql_real_escape_string() and addslashes() then stripslashes as far as safty? Quote Link to comment https://forums.phpfreaks.com/topic/141469-solved-list-and-stripslashes/#findComment-740514 Share on other sites More sharing options...
JonnoTheDev Posted January 19, 2009 Share Posted January 19, 2009 mysql_real_escape_string() escapes all special characters but will not leave the slashes on the string after it has been stored as addslashes() does. mysql_real_escape_string() should always be used on user inputted data for security. addslashes() can be a pain as you may get into a situation where slashes are added to existing slashes and you end up having to use string replace functions to clean them out as stripslashes() only removes the first instance. Quote Link to comment https://forums.phpfreaks.com/topic/141469-solved-list-and-stripslashes/#findComment-740516 Share on other sites More sharing options...
M.O.S. Studios Posted January 19, 2009 Author Share Posted January 19, 2009 very cool thanks for the tip Quote Link to comment https://forums.phpfreaks.com/topic/141469-solved-list-and-stripslashes/#findComment-740521 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.