Thread: storing arrays
View Single Post
  #4  
Old 03-28-2006, 10:21 AM
sabret00the's Avatar
sabret00the sabret00the is offline
 
Join Date: Jan 2003
Location: London
Posts: 5,268
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

thanks guys, i decided on the serialize in the late/early hours of last night, but just to give you an idea of what i'm doing

[sql]INSERT INTO ej_moodset(title, author, location, moods)
VALUES
('Hamsters', 'r2d2', 'images/ej/moods/r2d2__hamsters', 'a:127:{s:11:"Acomplished";s:15:"Acomplished.gif"; s:10:"Aggrivated";s:14:"Aggrivated.gif";s:6:"Amuse d";s:10:"Amused.gif";s:5:"Angry";s:9:"Angry.gif";s :9:"Apethetic";s:13:"Apethetic.gif";s:8:"Artistic" ;s:12:"Artistic.gif";s:5:"Awake";s:9:"Awake.gif";s :6:"+++++y";s:10:"+++++y.gif";s:4:"Blah";s:8:"Blah .gif";s:5:"Blank";s:9:"Blank.gif";s:5:"Bored";s:9: "Bored.gif";s:6:"Bouncy";s:10:"Bouncy.gif";s:4:"Bu sy";s:8:"Busy.gif";s:4:"Calm";s:8:"Calm.gif";s:9:" Cheerfull";s:13:"Cheerfull.gif";s:7:"Chipper";s:11 :"Chipper.gif";s:4:"Cold";s:8:"Cold.gif";s:10:"Com placent";s:14:"Complacent.gif";s:8:"Confused";s:12 :"Confused.gif";s:13:"Contemplative";s:17:"Contemp lative.gif";s:7:"Content";s:11:"Content.gif";s:6:" Cranky";s:10:"Cranky.gif";s:6:"Crappy";s:10:"Crapp y.gif";s:5:"Crazy";s:9:"Crazy.gif";s:8:"Creative"; s:12:"Creative.gif";s:7:"Crushed";s:11:"Crushed.gi f";s:7:"Curious";s:11:"Curious.gif";s:7:"Cynical"; s:11:"Cynical.gif";s:9:"Depressed";s:13:"Depressed .gif";s:10:"Determined";s:14:"Determined.gif";s:7: "Devious";s:11:"Devious.gif";s:5:"Dirty";s:9:"Dirt y.gif";s:10:"Discontent";s:14:"Discontent.gif";s:1 3:"Dissappointed";s:17:"Dissappointed.gif";s:10:"D istressed";s:14:"Distressed.gif";s:5:"Ditzy";s:9:" Ditzy.gif";s:5:"Dorky";s:9:"Dorky.gif";s:7:"Draine d";s:11:"Drained.gif";s:5:"Drunk";s:9:"Drunk.gif"; s:10:"Embaressed";s:14:"Embaressed.gif";s:9:"energ etic";s:13:"energetic.gif";s:7:"Enraged";s:11:"Enr aged.gif";s:10:"Enthralled";s:14:"Enthralled.gif"; s:7:"Envious";s:11:"Envious.gif";s:7:"Estatic";s:1 1:"Estatic.gif";s:9:"Exhausted";s:13:"Exhausted.gi f";s:6:"Flirty";s:10:"Flirty.gif";s:4:"Full";s:8:" Full.gif";s:9:"Fustrated";s:13:"Fustrated.gif";s:5 :"Geeky";s:9:"Geeky.gif";s:5:"Giddy";s:9:"Giddy.gi f";s:6:"Giggly";s:10:"Giggly.gif";s:6:"Gloomy";s:1 0:"Gloomy.gif";s:4:"Good";s:8:"Good.gif";s:9:"grat efull";s:13:"gratefull.gif";s:6:"Groggy";s:10:"Gro ggy.gif";s:6:"Grumpy";s:10:"Grumpy.gif";s:6:"Guilt y";s:10:"Guilty.gif";s:5:"Happy";s:9:"Happy.gif";s :4:"High";s:8:"High.gif";s:8:"Hopefull";s:12:"Hope full.gif";s:5:"Horny";s:9:"Horny.gif";s:3:"Hot";s: 7:"Hot.gif";s:6:"Hungry";s:10:"Hungry.gif";s:5:"Hy per";s:9:"Hyper.gif";s:9:"Impressed";s:13:"Impress ed.gif";s:13:"Indescribable";s:17:"Indescribable.g if";s:11:"Indifferent";s:15:"Indifferent.gif";s:10 :"infuriated";s:14:"infuriated.gif";s:11:"Intimida ted";s:15:"Intimidated.gif";s:5:"Irate";s:9:"Irate .gif";s:9:"Irritated";s:13:"Irritated.gif";s:7:"Je alous";s:11:"Jealous.gif";s:8:"Jubilant";s:12:"Jub ilant.gif";s:4:"Lazy";s:8:"Lazy.gif";s:8:"Listless ";s:12:"Listless.gif";s:6:"Lonely";s:10:"Lonely.gi f";s:5:"Loved";s:9:"Loved.gif";s:10:"Melancholy";s :14:"Melancholy.gif";s:6:"Mellow";s:10:"Mellow.gif ";s:11:"Mischevious";s:15:"Mischevious.gif";s:5:"M oody";s:9:"Moody.gif";s:6:"Morose";s:10:"Morose.gi f";s:7:"Naughty";s:11:"Naughty.gif";s:9:"Nausiated ";s:13:"Nausiated.gif";s:5:"Nerdy";s:9:"Nerdy.gif" ;s:7:"Nervous";s:11:"Nervous.gif";s:9:"Nostalgic"; s:13:"Nostalgic.gif";s:4:"Numb";s:8:"Numb.gif";s:2 :"Ok";s:6:"Ok.gif";s:10:"optimistic";s:14:"optimis tic.gif";s:9:"Peacefull";s:13:"Peacefull.gif";s:7: "Pensive";s:11:"Pensive.gif";s:11:"Pessimistic";s: 15:"Pessimistic.gif";s:10:"Pissed_Off";s:14:"Pisse d_Off.gif";s:7:"Pleased";s:11:"Pleased.gif";s:9:"P redetary";s:13:"Predetary.gif";s:10:"Productive";s :14:"Productive.gif";s:8:"Quixotic";s:12:"Quixotic .gif";s:9:"Recumbent";s:13:"Recumbent.gif";s:9:"Re freshed";s:13:"Refreshed.gif";s:8:"Rejected";s:12: "Rejected.gif";s:11:"Rejuvinated";s:15:"Rejuvinate d.gif";s:7:"Relaxed";s:11:"Relaxed.gif";s:7:"Reliv ed";s:11:"Relived.gif";s:8:"Restless";s:12:"Restle ss.gif";s:6:"Rushed";s:10:"Rushed.gif";s:3:"Sad";s :7:"Sad.gif";s:9:"Satisfied";s:13:"Satisfied.gif"; s:6:"Scared";s:10:"Scared.gif";s:7:"Shocked";s:11: "Shocked.gif";s:4:"Sick";s:8:"Sick.gif";s:5:"Silly ";s:9:"Silly.gif";s:6:"Sleepy";s:10:"Sleepy.gif";s :4:"Sore";s:8:"Sore.gif";s:8:"Stressed";s:12:"Stre ssed.gif";s:9:"Surprised";s:13:"Surprised.gif";s:1 1:"Sympathetic";s:15:"Sympathetic.gif";s:9:"thankf ull";s:13:"thankfull.gif";s:7:"Thirsty";s:11:"Thir sty.gif";s:11:"Thoughtfull";s:15:"Thoughtfull.gif" ;s:5:"Tired";s:9:"Tired.gif";s:7:"Touched";s:11:"T ouched.gif";s:13:"uncomfortable";s:17:"uncomfortab le.gif";s:5:"Wierd";s:9:"Wierd.gif";s:7:"Working"; s:11:"Working.gif";s:7:"Worried";s:11:"Worried.gif ";}')[/sql]

the query consists of like 17 of those, 35,000 characters long but only 0.0117 seconds to execute.

however retreival goes a little something like this
PHP Code:
function construct_mood($moodsetid)
{
    global 
$vbulletin;

    
$mood_options $vbulletin->db->query_first("SELECT moods FROM ej_moodset WHERE moodsetid = " intval($moodsetid) . "");

    
$mood_options unserialize($mood_options['moods']);

    
$mood_drop '<select name="current_mood" onChange="changeSelectImg(this);"><option value=""></option>';

    foreach (
$mood_options AS $key => $value)
    {
        
$mood_drop .= '<option value="' $value '">' $key '</option>';
    }

    
$mood_drop .= '</select>';

    return 
$mood_drop;

which is why i was worrying about getting the serialize.
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01261 seconds
  • Memory Usage 1,805KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_php
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • showpost_complete