minxie6 Posted March 2, 2008 Share Posted March 2, 2008 what is the best way do display the results from a tick box array stored in my_sql? I am using serialize to store it is this correct? $colourmess=$_POST["colour"]; $colourstring=serialize($colourmess); $colourstring=htmlentities($colourstring,ENT_QUOTES); echo $colourstring; but when I read from it i get; a:2:{i:0 s:5:" white" i:1 s:5:" black" } i want a tick box so i can store colours and then display them not the other rubbish aswell, could someone point me in the right direction as i am shore this must have tutorials but i cant find any? plz help thanks leah Quote Link to comment https://forums.phpfreaks.com/topic/94014-displaying-results-from-an-array-stored-in-database/ Share on other sites More sharing options...
ignace Posted March 2, 2008 Share Posted March 2, 2008 <?php print_r(unserialize($colourstring));?> gives you back the array Quote Link to comment https://forums.phpfreaks.com/topic/94014-displaying-results-from-an-array-stored-in-database/#findComment-481633 Share on other sites More sharing options...
minxie6 Posted March 2, 2008 Author Share Posted March 2, 2008 i done that thank you!! but how do i display it? at the moment i just get "array" i need to display just the colour's from it, not the array infomation? can this be done? sorry for beeing so stupid but i am trying to learn leah x Quote Link to comment https://forums.phpfreaks.com/topic/94014-displaying-results-from-an-array-stored-in-database/#findComment-481729 Share on other sites More sharing options...
Baabu Posted March 2, 2008 Share Posted March 2, 2008 <?php print_r(unserialize($colourstring));?> first store the result comming from unserialize($watever) to any array and then display that array i gues Quote Link to comment https://forums.phpfreaks.com/topic/94014-displaying-results-from-an-array-stored-in-database/#findComment-481732 Share on other sites More sharing options...
minxie6 Posted March 2, 2008 Author Share Posted March 2, 2008 but how do i display the contents of the stored array? i just get Array, i need just the stuff i put in? Quote Link to comment https://forums.phpfreaks.com/topic/94014-displaying-results-from-an-array-stored-in-database/#findComment-481740 Share on other sites More sharing options...
Baabu Posted March 3, 2008 Share Posted March 3, 2008 $var=unserialize($colourstring); foreach($var $key => $value) echo "At $key we have $value"; try this out Quote Link to comment https://forums.phpfreaks.com/topic/94014-displaying-results-from-an-array-stored-in-database/#findComment-482205 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.