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

Reply
 
Thread Tools Display Modes
  #1  
Old 02-14-2005, 02:11 PM
Benumbed Benumbed is offline
 
Join Date: Oct 2004
Posts: 52
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Parse $pagetext for members...

Posted this in another forum but I think it might have been wrong one...

Type Names in a textbox, using

print_textarea_row($vbphrase['text'], 'pagetext', $raid['pagetext'], 10, 50, 1, 0);

When you click add attendees, it will parse thru each one and add new record in raid_attendees table.

Example:

(Enter this into pagetext)

Blah
Bleh
Blah2
Bleh2
Blah3
Bleh3

When you hit submit, it will parse thru each with a linebreak and...

add new record in a table for blah
add new record in a table for bleh
add new record in a table for blah2
add new record in a table for bleh2
add new record in a table for blah3
add new record in a table for bleh3

I know its some kind of an array, but cant figure out how to loop it and use each name.

No one?

I am doing this in an edited announcement.php file inside modcp if that helps.
Reply With Quote
  #2  
Old 02-15-2005, 09:54 AM
Dean C's Avatar
Dean C Dean C is offline
 
Join Date: Jan 2002
Location: England
Posts: 9,071
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Try and explain yourself a bit better, screenshot may help
Reply With Quote
  #3  
Old 02-15-2005, 02:53 PM
Benumbed Benumbed is offline
 
Join Date: Oct 2004
Posts: 52
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

print_textarea_row($vbphrase['text'], 'pagetext', $raid['pagetext'], 10, 50, 1, 0);

(Included into screenshot with names in box)

When I hit submit, it will parse thru each line break and ...

Add Benumbed into table "raid_attendees"
Add Renwo into table "raid_attendees"
Add Fila into table "raid_attendees"
Add Valura into table "raid_attendees"
Add Agronom into table "raid_attendees"
Add Ewoc into table "raid_attendees"
Add Eman into table "raid_attendees"

Basically just does a for each (line break) enter name into database.

I know it sounds retarded why I want to do it this way, but I play a game where it takes a copy of raid attendees (which can be 40-50+) and I just paste in a textfile so I can update there attendance (they get rewards, etc).
Attached Images
File Type: gif pagetext.gif (10.5 KB, 0 views)
Reply With Quote
  #4  
Old 02-15-2005, 08:46 PM
Dean C's Avatar
Dean C Dean C is offline
 
Join Date: Jan 2002
Location: England
Posts: 9,071
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

PHP Code:
$names preg_split('/[\r\n]+/'$names);
foreach(
$names AS $key => $val)
{
// do your queries here 

Reply With Quote
  #5  
Old 02-16-2005, 04:13 AM
Benumbed Benumbed is offline
 
Join Date: Oct 2004
Posts: 52
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

PHP Code:
        $names preg_split('/[\r\n]+/'$names); 
        foreach(
$names AS $key => $val
        { 
        
$attendees['member_name'] = $val;

        
$attendees['raid_id'] = $raididnow['raid_id'];
        
$DB_site->query(fetch_query_sql($attendees'dkp_raid_attendees ')); 
How would I call it back into the format it was in for modify raid?

also (sorry, I really am)

How would you parse this:

Code:
1	Borr	60	Paladin	
1	Fila	60	Warrior	
1	Mightyal	59	Warrior	
1	Soulss	60	Priest	
1	Taparoo	60	Warlock	
2	Crazy	60	Paladin	Officer
2	Cronis	60	Mage	
2	Ewoc	60	Warrior	
2	Shortee	60	Rogue	
2	Xirro	60	Druid	
3	Agronom	60	Paladin	
3	Benumbed	60	Priest	Raid Leader
3	Souldat	60	Rogue	
3	Warv	60	Paladin
and remove everything but the names
Reply With Quote
  #6  
Old 02-16-2005, 09:01 AM
Dean C's Avatar
Dean C Dean C is offline
 
Join Date: Jan 2002
Location: England
Posts: 9,071
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Benumbed
PHP Code:
        $names preg_split('/[\r\n]+/'$names); 
        foreach(
$names AS $key => $val
        { 
        
$attendees['member_name'] = $val;

        
$attendees['raid_id'] = $raididnow['raid_id'];
        
$DB_site->query(fetch_query_sql($attendees'dkp_raid_attendees ')); 
How would I call it back into the format it was in for modify raid?

also (sorry, I really am)

How would you parse this:

Code:
1	Borr	60	Paladin	
1	Fila	60	Warrior	
1	Mightyal	59	Warrior	
1	Soulss	60	Priest	
1	Taparoo	60	Warlock	
2	Crazy	60	Paladin	Officer
2	Cronis	60	Mage	
2	Ewoc	60	Warrior	
2	Shortee	60	Rogue	
2	Xirro	60	Druid	
3	Agronom	60	Paladin	
3	Benumbed	60	Priest	Raid Leader
3	Souldat	60	Rogue	
3	Warv	60	Paladin
and remove everything but the names
What is this exactly? Is it a string or databse structure or...? Please try and describe yourself a little better
Reply With Quote
  #7  
Old 02-16-2005, 01:01 PM
Benumbed Benumbed is offline
 
Join Date: Oct 2004
Posts: 52
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

PHP Code:
        $names preg_split('/[\r\n]+/'$names); 
        foreach(
$names AS $key => $val
           { 
           
$attendees['member_name'] = $val

           
$attendees['raid_id'] = $raididnow['raid_id']; 
           
$DB_site->query(fetch_query_sql($attendees'dkp_raid_attendees ')); 
           } 
That is the code to place each name in the database seperate from each other (like you gave me the code for. Just when I go to edit/modify the raid, it is all together. Was wondering if there was a code to reverse it back into format of:

Name
Name2
Name3

Code:
1	Borr	60	Paladin	
1	Fila	60	Warrior	
1	Mightyal	59	Warrior	
1	Soulss	60	Priest	
1	Taparoo	60	Warlock	
2	Crazy	60	Paladin	Officer
2	Cronis	60	Mage	
2	Ewoc	60	Warrior	
2	Shortee	60	Rogue	
2	Xirro	60	Druid	
3	Agronom	60	Paladin	
3	Benumbed	60	Priest	Raid Leader
3	Souldat	60	Rogue	
3	Warv	60	Paladin
That is the code I am copying & pasting into $pagetext form that I am runnin the top php code on to insert each name into the database. Right now, I am having to delete the spaces, numbers, class, leader, etc. and get it in:

Name
Name2
Name3

format. What I am asking is there a preg_strip to strip all from but names, then enter it in database. Sorry for not giving good details, its kinda hard for me to explain what it all this does =\
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 05:43 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.07068 seconds
  • Memory Usage 2,258KB
  • Queries Executed 12 (?)
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
  • (3)bbcode_code
  • (4)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (7)post_thanks_box
  • (7)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (7)post_thanks_postbit_info
  • (7)postbit
  • (1)postbit_attachment
  • (7)postbit_onlinestatus
  • (7)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
  • postbit_attachment
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete