vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   calendarcustomfields options field into array (https://vborg.vbsupport.ru/showthread.php?t=143329)

kj_ugs 03-27-2007 05:55 PM

calendarcustomfields options field into array
 
I'm wondering how i extract all the custom options from the table field options in the calendarcustomfields table.

When i look in the database all the custom options seem to be stored in one field in a format that looks like indexes or an array or something. How do i extract each value and put it into an array using php and mysql?

I know how to query the database but i don't know how to seperate those values in that field.

For example, i want to take the data in that field...

a:6:{i:1;s:3:"Gig";i:2;s:10:"Club Night";i:3;s:10:"Networking";i:4;s:7:"Lecture";i:5 ;s:7:"Seminar";i:6;s:5:"Other" ;}

and put it into an array...
Gig night
Networking
Lecture
Seminar
Other

Any help on this would be greatfully appreciated.

Thanks

MarkPW 03-27-2007 06:35 PM

Use unserialize($yourdata);

kj_ugs 03-27-2007 06:44 PM

So I'd pull that field data into a variable called $yourdata and then use unserialize on it?

Thanks!

MarkPW 03-27-2007 07:35 PM

Yes - use print_r() to test the output and (using your example) you should see the following:

Array ( [1] => Gig [2] => Club Night [3] => Networking [4] => Lecture [5] => Seminar [6] => Other )

kj_ugs 03-27-2007 08:03 PM

Thanks Mark, that helps a lot :)

KJ


All times are GMT. The time now is 02:18 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01032 seconds
  • Memory Usage 1,710KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (5)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete