Jump to content

Venorize

New Members
  • Posts

    5
  • Joined

  • Last visited

    Never

Everything posted by Venorize

  1. Substr worked wonders, it solved all my display issues! Thank you so much!
  2. I have an XML document that id decrypted and shown onto a table. At the bottom of the page, I'm trying to have it count up one foreach($Data as $Types) // loop through book foreach($Types as $Colors) // loop through book { print_r(count($Colors->Color)); } There are 4 colors, blue, green, red, yellow. Blue is listed 7 times, green is 3, red is 8, and yellow is 4 times. What I expect it to print is: 7 3 8 4 Instead, it's printing this: 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 If I was to just do the print function without count, it lists like this: blue red blue red green yellow blue red yellow red red green yellow yellow blue blue green blue yellow blue red red blue red My end-goal of this code is to get it to print this: Blue: 7 Green: 3 Red: 8 Yellow: 4
  3. Thanks again everyone, PFMaBiSmAd I actually might use that for a different function, I see how it can be helpful if the variables change enough, but my ranks will never change past the 100 that I have already (I only listed a few as an example). Now I wasn't going to post about this, but I might as well ask since your all so incredibly helpful The only other issue I have is that one of the columns lists a Date, down to the millisecond. An example of one of the things listed is: 2011-10-29T04:19:36.75 That is how the format is in the XML document it is extracting it from. Is there a way I can have it cut off ANYTHING at that "t" and after? I don't need the time, just the date listed. Even further, if possible, to re-arrange the date from "2011-10-29" to maybe like "Oct 29, 11" ? Again this data is being extracted by php from an XML document which is updated weekly, and there is nearly two thousand lines of data it extracts, so changing them manually would be out of the question. Finally, like I said above, the table is already completed, I already have the code that extracts all the dates and displays them in the table column. I just need the code to read a date it gives "2011-10-29T04:19:36.75" and display it without the timestamp after it (and possible in a better format if that's even possible). To change it like I did with the ranks isn't possible with nearly 2,000 lines of data. lol. Thanks again, I tried to explain the issue as clearly as I could!
  4. I guess I was overdoing it trying to keep everything in the correct brackets and such. I've only been at this for about a month. I've got a pretty successful database going based off what I learned by googling... Usually I can figure out my own mistakes, But this one just had me stuck for hours and I figured it was a good time to ask for help. This works now, thank you so much guys
  5. [About the code] Basically what I have is a web page that de-codes a complex XML document, and displays it as a table. This is working successfully. One of the columns in the tables displays a "rank" of an object as a number (0-9). This is working successfully. What I did was write a code that would translate that rank number into a specified text, depending what number it was. [The Code] (This is only the partial code with the problem in it, the entire code of the page is very extensive.) $RankNum = "{$Member->Rank}"; // {$Member->Rank} successfully displays the rank number on it's own. Below 'should' translate that number into the name of the rank. if('$RankNum' == 0) { echo('test1');}; if('$RankNum' == 1) { echo('test2');}; if('$RankNum' == 2) { echo('test3');}; if('$RankNum' == 3) { echo('test4');}; if('$RankNum' == 4) { echo('test5');}; [The Problem] All this code keeps displaying "test1" for every value in the entire column, regardless if it equaled 1 or 2 or higher... I know this has to be some simple coding mistake, but I've been sitting here for an hour trying to figure out what I had done wrong. Thanks in advance
×
×
  • 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.