Jump to content

Kasuke_Akira

Members
  • Posts

    39
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Kasuke_Akira's Achievements

Member

Member (2/5)

0

Reputation

  1. I was curious if someone had an example of how to pull the first value out of an array ($array[0]) and compare it to every following value in the array ($array[1],[2],etc....) Then compare the next value ($array[1]) and compare it to every following value ($array[2],[3],etc....). The goal is to find any matches and, if so, to report that match. I'm having trouble how to figure it out. Someone recommended a combination of foreach() and array_search() but I didn't get it.
  2. I have a big huge question here. I've been having trouble how to get everything to work together. I have two textareas: main, side I need to take the information from main and side which will always look like this in its general format: 4 Shock 3 Disenchant etc.... I need to check main and side (independantly within their ownselves) for any duplicate entries such as: 4 Shock 2 Shock Then I need to compare main and side to be sure if there are duplicate entries, they dont add up to more than 4. The thing with all this is, each textarea is being arrayed by using: $main_split = explode("\n", $main); which results in: $main_split[0] = "4Shock" then each set pulled out is being furthered arrayed as such: $main_card_split = explode("\n", $main_split[$i], 3); which results in: $main_card_split[0] = "4" | $main_card_split[1] = "Shock" I'm using while statements to achieve this already. I just need to be able to take the words and compare within each textbox to make sure there are no duplicates, then compare the main and side to check that if there are duplicates, their corresponding numeric values only add up to 4.
  3. Ahh..ok..didnt know about GROUP BY..i need to read a mySQL book...lol
  4. if you order by fieldname..it rearranges the table by field name, grouping all the same together before it is processed. then it would cycle through each enrty, it only grabs the num rows in the DB WHERE $field_name = $temp, after it decides if that $temp != $data[fieldname]. when it does come across one that doesnt equal it, it assigns $temp the new value, searches the table for all the rows with field_name = $temp, counts them up, displays and continues to run through each row, till it finds a nother that isnt equal it should work cuz i use the same concept to group names based on a certain type in another website i have. if you order by, it orders the whole table in that order grouping ebay, yahoo, etc together... Besides, I don't see syntax errors. and it IS ordered by field_name (you jsut replace 'field_name' with the appropriate fieldname.............the same with any instance of 'table' the only reason it wouldnt work is if i typed something wrong. but the concept is right as long as everything is typed right.
  5. Wow, that would make things eaasier. all u have to do is store one format and u can convert it to any you need.
  6. mebbe you overwrote a file with some common name so now only one of the file's information is there?
  7. $result = mysql_db_query(SELECT * FROM table ORDER BY field_name); $temp = ""; while ($data = mysql_fetch_array($result)) { if ($temp != $data[field_name]) { $temp = $data[field_name]; $num_rows = mysql_num_rows(SELECT * FROM table WHERE field_name = '$temp'); echo "$temp = $num_rows<br />"; } } That should work..if not tell me errors and I'll figure it out. I'm at work and have no way to look at my scripts to see if it's right.
  8. Ahh, thanks. lol...i was using commas instead of | so i knew it wasnt working..just didnt know wut it should be. thanks
  9. Here's what an example set of arrays looks like. There are over 100 search strings with corresponding replacement strings: $search_str[0] = '/Time Spiral Common/'; $search_str[1] = '/Time Spiral Unommon/'; $search_str[2] = '/Time Spiral Rare/'; $search_str[3] = '/Stronghold Common/'; $search_str[4] = '/Stronghold Unommon/'; $search_str[5] = '/Stronghold Rare/'; $replace_str[0] = '<img src\'images/tsp c.gif\'>'; $replace_str[1] = '<img src\'images/tsp u.gif\'>'; $replace_str[2] = '<img src\'images/tsp r.gif\'>'; $replace_str[2] = '<img src\'images/sth.gif\'>'; $replace_str[3] = '<img src\'images/sth.gif\'>'; $replace_str[4] = '<img src\'images/sth.gif\'>'; If you notice for the images for TS, they vary based on Rare, Uncommon, or Common However, there are no different images for each rarity of Stronghold, the same image has to be used. but I don't want to have to define 3 different search and image arrays, for the same image. I know you can do stuff like this : [0-9] and it will search for anything between 0 and 9 instead of having to do a separate instance in the array for each number. but I need the same thing to be done with common uncommon and rare so that Stronghold is constant, but one of those other three can be true as well: $search_str[3] = '/Stronghold [Common,Uncommon,Rare]/'; I know that isn't how it works, but I think you may understand what I mean now.
  10. Hmm..lets try a different approach..lol I want any instances of Stronghold Common, Stronghold Uncommon, Stronghold Rare to be replaced with: $replace_str[0] = '<img src\'images/sth.gif\'>'; But I don't want to have to do this: $search_str[0] = '/Stronghold Common/'; $search_str[1] = '/Stronghold Unommon/'; $search_str[2] = '/Stronghold Rare/'; $replace_str[0] = '<img src\'images/sth.gif\'>'; $replace_str[1] = '<img src\'images/sth.gif\'>'; $replace_str[2] = '<img src\'images/sth.gif\'>'; I want to do this: $search_str[0] = '/Stronghold [different options]/'; $replace_str[0] = '<img src\'images/sth.gif\'>';
  11. I have three options: Stronghold Common Stronghold Uncommon Stronghold Rare I want preg_replace() to search for all three, and replace with the same array so that I don't have to make three seperate array options for each entry but I'm not sure what the search string would look like.
  12. How would i grab the first value [0] in an array, check to see if any value after it[1][..] is the same, and then move to the next one[1], checking if to see if any value after that one [2][..] is the same?
  13. I have this variable: $str = "4xAura Extraction"; I need it to split the string into two separate strings containing this: $split[0]: 4 $split[1]: Aura Extraction I can't use explode(), because that will split it up again if there are x's other than the one that comes after the number. What would be the best way to get this done. I'm asking because I'm not real good at string manipulation when it comes to mutilating them. lol Thanks
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.