the problem & context

the problem: i want a way to easily copy and paste my laundry list of doubles into the doubles exchange form

the solution: display your doubles as text. bonus for only showing the first x amount to easily copy and paste into that exchange form, or a trade form, or whatever you want.

caveats: i think someone already did this, so there is probably another better way out there! there are going to be some optional sections here so just read through and take out what you want/don't want

the mod

in your mods.php add this. note the // sections for what you can remove/include if you want!

function ilovejaehyundoubles( $tcg, $category ) {

          		$database = new Database;
          		$sanitize = new Sanitize;
          		$tcg = $sanitize->for_db($tcg);
          		$category = $sanitize->for_db($category);
          		$altname = strtolower(str_replace(' ','',$tcg));

          		$tcginfo = $database->get_assoc("SELECT * FROM `tcgs` WHERE `name`='$tcg' LIMIT 1");
          		$tcgid = $tcginfo['id'];
          		$cardsurl = $tcginfo['cardsurl'];
          		$format = $tcginfo['format'];

          		$cards = $database->get_assoc("SELECT `cards`, `format` FROM `cards` WHERE `tcg`='$tcgid' AND `category`='$category' LIMIT 1");
          		if ( $cards['format'] != 'default' ) { $format = $cards['format']; }

          		if ( $cards['cards'] === '' ) { echo '

There are currently no cards under this category.
'; }
          		else {

          			$cards = explode(',',$cards['cards']);
          			$cards = array_map(trim, $cards);
          			$doubles = array_diff_assoc($cards, array_unique($cards));

          			if ( !empty($doubles) ) {
                //REMOVE THESE NEXT 3 ROWS IF YOU DONT WANT TO DISPLAY YOUR DOUBLE COUNT
          				//if you don't know what this is referring to please EDUCATE YOURSELF youtu.be/_eLddzLagsg
          				$johfans = sizeof($doubles);
          				echo $johfans.' doubles 

';

                  //REMOVE NEXT 3 ROWS IF YOU DONT WANT TO DISPLAY FIRST 20 DOUBLES. You can also change the 20 to another number
                    $FRED = array_slice($doubles, 0, 20);
                    $JASON = implode(', ',$FRED);
                    echo '<b>First 20: </b>'.$JASON.'<br><br>';

                  $doubles = implode(', ',$doubles);

                  echo $doubles;

                  }
                  else {

                    echo '<p><em>There are currently no cards under this category.</em></p>';
                    //if this happens to you put it in #achievements channel bc it will NEVER HAPPEN

          			}

          		}

          	}

where you want to display your doubles list

<?php ilovejaehyundoubles('idolise','trading'); ?><br>