Jump to content

absenm

New Members
  • Posts

    8
  • Joined

  • Last visited

    Never

Everything posted by absenm

  1. Oh gee.... I should have known/noticed that. Arggg... That's what happens when your self taught. Got it to work now. Thanks everyone for your help. In the interest of completeness, here is the working code I came up with. $onlineData = mysql_query("SELECT COUNT(DISTINCT cCode) AS number FROM onlinenow"); $row = mysql_fetch_array($onlineData); $cDiff = $row[0]; Thanks Again!
  2. still getting "Resource id #30" when I echo $cDiff;
  3. I've been searching around for this for a while and nothing seems to be working properly. On my website I track who is online at the time (within the past 15 minutes). My database contains important information like ip addresses and page views during the visit. It also contains a column for two digit country codes (US, NL, CA, GB, etc.) It works great. But I'd like to display to my visitors how many countries people are visiting from at the time. I might have ten people from the US, three from England, and one from Canada. I'd like it to say we have visitors from 3 countries. My hope this could be accomplished with a simple query. Here's the code I have ended up with. But it's not working. Each visitor has one row in the table. "cCode" is the column name and "onlinenow" is the table name. I would have changed the names in my code below but I wanted to post my code exactly as is. $cDiff = mysql_query("SELECT cCode, COUNT(cCode) AS number FROM onlinenow"); I also tried.... $cDiff = mysql_query("SELECT cCode, COUNT(DISTINCT cCode) AS number FROM onlinenow"); It results in returning "Resource id#30" for the value of cDiff. What am I doing wrong. I am self taught and please forgive me if I didn't use the correct lingo. Thank You In Advance.
  4. Wow, thank you all. KevenM1 - That article was great and gave me a much better understanding and what I need to do and what I have been doing wrong. Muddy_Funster & scootstah - Yes, I have been thinking about this all the wrong way. Further research has also pointed out to me that a couple million rows (or records) is not much really. As long as I do it properly and make sure I got the right indexes and keys. And in retrospect, those millions of datapoints are still in my current setup, just spread-out through the columns. Thank you all.
  5. KevenM1 - I am beginning to read that article. There is a lot to wrap my head around so I will comment later about it and whether it was helpful to my issue. scootstah - If I am understanding your suggestion properly, every day would increase the table size by 3500 rows. Just a years worth of data would have 1.27 million rows. That seems scary large. Or am I looking at this the wrong way.
  6. Thank you all for your prompt replies. To help clarify... Basically the data structure I currently have is Item Name, Price Day1, Price Day2, Price Day3, ... Price Day 365 where each item has its own row in the table. We track 3500 items. As someone already mentioned, yes it is more of a spreadsheet style. Sample data would be Dragon stone, 7832, 7833, 7900, ... 7950 My website determines the date of the data based on the column location, for example day90 would be three months ago. Again I know this is terrible. I didn't know what I was doing when I first designed the site. Now I get three million hits a year and I really want to do things properly so I can grow as a developer and my site can grow within its community. I am completely self taught. And I probably learned more bad things then good. Like using mySql like Excel. If you want to see how the data is used try this page http://www.grandexchangecentral.com/item.php?rid=21369. I hope posting that link doesn't violate the rules. I did just read them again and I think I'm fine.
  7. Before anyone flames me, I want to be clear, I have searched and researched this issue for years. Maybe its my keywords or maybe its just my understanding, but nothing I have found seems satisfactory or even addresses my specific need. Anyway, my gratitude in advance for everyone being polite and patient. I have a website that keeps track of pricing data for an online gaming site. When I made it I had no understanding of coding beyond BASIC on a Color Computer II from 1981. So I put together everything bit by bit. Now its three years later and I have a much much greater understanding of things. But I'm stuck with a data base that contains 365 columns just for a year of pricing data on an item. And I want to keep all data for every new day, not just one year. I know there has got to be a better way then name,bla,bla,day1,day2,day3,day4,day5... and adding columns for every new day. Any suggestions? And I know this question is mostly focused on MySQL (actually any database but I use MySql) rather than PHP. But PHP will be playing an integral part of maintaining the database. Plus, the people here are always incredibly knowledgeable, and polite. Again, the specific question is how should I design a database that will keep an on-going history of pricing data?
  8. I have been searching the php forums for days trying to find and answer to this issue. Now I am going to actually ask outright and seek some direct help from everyone here. I am encountering a nightmare of a problem when it comes to acquiring remote data from a website to include in the php files of my website. My website is a Runescape fan site and Jagex, the company that makes the online game, has created a striped down version of their player high scores page so that fans can easily incorporate the data into their own sites. The page when loaded in a browser from their site looks like this: It is specifically designed for easy parsing. My problem is that I can not seem to get my php file to recognize the file address. Jagex made the page I am requesting specifically for php retrieval so they don't have any blocks on it. Also, the link, http://hiscore.runescape.com/index_lite.ws?player=absenm, works perfectly in a browser. I fear that it may be the 'hiscore' subdomain that may be the issue, but I am not sure. It seems like I can pull their home page at www.runescape.com but cannot touch the hiscore subdomain. There are dozens of scripts available on the internet designed to retrieve this information page from Runescape. Right now I am only concerned with the connectivity, not the parsing abilities. There is no reason to work on the parsing if there is nothing to parse. Anyway, all of the scripts I tried, and I tried everyone I could find, comes back with similar errors to those below: Here is one of the many scripts that I tried. It is not obviously what I am going to use in the end, but it is useful for testing my connectivity. <?PHP $user="absenm"; $txt=file_get_contents('http://hiscore.runescape.com/index_lite.ws?player='.$user); $data = explode ("\n", $txt); $looper=0; $skillno=0; while ($looper<30){ $type = explode(",",$data[$looper]); $rank[$skillno]=$type[0]; $lvl[$skillno]=$type[1]; $xp[$skillno]=$type[2]; $looper++; $skillno++; } ?> One last note of interest. allow_url_fopen and allow_url_include are set to (1) on. If you need to see the rest of my PHP information, I have a phpinfo script at http://runethoughts.x10hosting.com/hscore.php Please, any help would be greatly welcomed. Retrieval of this data from Runescape is very important to the future design of my website.
×
×
  • 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.