Snooble Posted August 10, 2009 Share Posted August 10, 2009 Hey everyone, thanks in advance! I'm creating bingo cards using PHP and MySQL. I wondered what the best way of doing so is.. So far my idea is: Use php to shuffle an array of values, choose first 10, (10 items per bingo card), and save each choice in a separate column under an id. I need each card to be UNIQUE, and I need to have a record of the items on the card by checking the id. Any tips on making sure each card is unique would be GREATLY appreciated, as I'm a bit stuck! Thank you! Snooble Quote Link to comment https://forums.phpfreaks.com/topic/169601-solved-help-with-coding-overview/ Share on other sites More sharing options...
alexdemers Posted August 10, 2009 Share Posted August 10, 2009 Store a md5() of each card. Let's say your array is: [ [5, 6, 7, 9, 11] [16, 18, 21, 25, 26] [30, 35, 36, 37, 40] [47, 48, 51, 52, 55] [65, 69, 71, 72, 73] ] $stored_value = md5(serialize($bingo_card_array)); Quote Link to comment https://forums.phpfreaks.com/topic/169601-solved-help-with-coding-overview/#findComment-894754 Share on other sites More sharing options...
Snooble Posted August 10, 2009 Author Share Posted August 10, 2009 so if i serialize the array, i can compare one WHOLE bingo card to another? Would i need to sort the results first to make the serialized arrays the same? Thanks Snooble Quote Link to comment https://forums.phpfreaks.com/topic/169601-solved-help-with-coding-overview/#findComment-894780 Share on other sites More sharing options...
alexdemers Posted August 10, 2009 Share Posted August 10, 2009 so if i serialize the array, i can compare one WHOLE bingo card to another? Would i need to sort the results first to make the serialized arrays the same? Thanks Snooble Well, bingo cards are usually sorted so I guess it should be sorted in the array. Comparing one whole bingo card to another will work but only return true or false if they are the same, they won't return the differences between the two. Quote Link to comment https://forums.phpfreaks.com/topic/169601-solved-help-with-coding-overview/#findComment-894788 Share on other sites More sharing options...
Snooble Posted August 10, 2009 Author Share Posted August 10, 2009 okok.. I think i can take it from here. Thank you. Quote Link to comment https://forums.phpfreaks.com/topic/169601-solved-help-with-coding-overview/#findComment-894794 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.