vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Parse $pagetext for members... (https://vborg.vbsupport.ru/showthread.php?t=76305)

Benumbed 02-14-2005 02:11 PM

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.

Dean C 02-15-2005 09:54 AM

Try and explain yourself a bit better, screenshot may help :)

Benumbed 02-15-2005 02:53 PM

1 Attachment(s)
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).

Dean C 02-15-2005 08:46 PM

PHP Code:

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



Benumbed 02-16-2005 04:13 AM

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

Dean C 02-16-2005 09:01 AM

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 ;)

Benumbed 02-16-2005 01:01 PM

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 =\


All times are GMT. The time now is 10:04 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.01069 seconds
  • Memory Usage 1,757KB
  • 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
  • (3)bbcode_code_printable
  • (4)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (7)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