Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 08-29-2006, 11:58 PM
MikaK's Avatar
MikaK MikaK is offline
 
Join Date: Nov 2004
Location: Helsinki, Finland
Posts: 134
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Pulling data out from customfields

I'm planning to show 1 event by memebrs at their public profile.

This should be the query:
PHP Code:
$query "SELECT `eventid` , `userid` , `title` , `customfields` , `dateline_from`  
FROM `" 
TABLE_PREFIX "event`
WHERE userid = '
$userinfo[userid]
ORDER BY `dateline_from` DESC
LIMIT 1"

In my case the customfields contains data regarding event type and location
like in the following example: a:2:{i:1;s:4:"Club";i:2;s:8:"Helsinki";}

What would be the best php code snippet for getting "Club" and "Helsinki" in displayed the final output?

Thanks for any insight.
-Mika
Reply With Quote
  #2  
Old 08-30-2006, 02:20 AM
Corsec Corsec is offline
 
Join Date: Jan 2004
Posts: 3
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

That is the data you want. It is an array (as seen by the "a" at the start I think) with 2 objects (denoted by the 2 at the start I believe, Im not entirely sure the inner workings of serializing data).

You can do this:

$customArray = unserialize($row["customfields"]);

array(2) {
[1]=>
string(4) "Club"
[2]=>
string(8) "Helsinki"
}
Reply With Quote
  #3  
Old 08-30-2006, 05:15 AM
MikaK's Avatar
MikaK MikaK is offline
 
Join Date: Nov 2004
Location: Helsinki, Finland
Posts: 134
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Corsec
array(2) {
[1]=>
string(4) "Club"
[2]=>
string(8) "Helsinki"
}
Thanks, man! Glad to hear I'm getting there - even if by small steps Now... I still wonder how to formulate string (4) "Club" and string(8) "Helsinki" so it appears dynamically in the final output?
Quote:
array(2) {
[1]=>
$bbinfo['calendarfield1']
[2]=>
$bbinfo['calendarfield2']
}
perhaps?


This is the code outlining also the problematic, still missing variables
PHP Code:
$limit_page1 '1';    // Enter the number of maximum events you want to have displayed

$get_events DB_site->query ("SELECT `eventid` , `userid` , `title` , `customfields` , `dateline_from`  
FROM `" 
TABLE_PREFIX "event`
WHERE userid = '
$userinfo[userid]
ORDER BY `dateline_from` DESC
LIMIT 
$limit_page1");  

while(
$events $DB_site->fetch_array($get_events))
    {
        
exec_switch_bg();
        
$events['date'] = vbdate($vboptions['dateformat'],$events['dateline_from']);
        
// THE PROBLEM
        // how to formulate the customfields based variables ?
        // Below should be pulling clendar customfield id 1
        
$events['type'] = ' ';
        
// Below should be pulling clendar customfield id 2
        
$events['location'] = ' ';
        eval(
'$usersevents .= "' fetch_template('memberinfo_usersevents') . '";');
    } 
Now my problem only seems to be how to implement the above offered snippet into $events['type'] = ' '; and $events['location'] = ' ';

Once again... Thank's for any insight.

-Mika
Reply With Quote
  #4  
Old 09-09-2006, 02:25 PM
MikaK's Avatar
MikaK MikaK is offline
 
Join Date: Nov 2004
Location: Helsinki, Finland
Posts: 134
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

case solved and closed.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 03:36 AM.


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.04284 seconds
  • Memory Usage 2,195KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (2)bbcode_php
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (4)post_thanks_box
  • (4)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (4)post_thanks_postbit_info
  • (4)postbit
  • (4)postbit_onlinestatus
  • (4)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • 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
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete