Jump to content

David Nelson

Members
  • Posts

    28
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

David Nelson's Achievements

Member

Member (2/5)

0

Reputation

  1. Genius method. That took the DB to a much more manageable 1.1 million rows. Thanks a ton! David
  2. Hey guys, I manage a large service that has dozens of MySQL read/writes coming in every second - one of our tables now has over 5+ million rows (and about 500MB of data), and the structure has three columns: userid | data | timestamp "userid" is a unique identifier for the user responsible for the data. Some users have thousands and thousands of entries -- others have only a few. For those users with greater than 600 entries, I'd like to keep only their most recent 600 entries. Luckily we store a timestamp! So, from a programming standpoint my thought was that I would have to loop through every single row, identify "duplicate" userids, put them into an array with their respective data and timestamps, and eventually purge those arrays down to 600 rows only, etc.. You can see that this would be pretty complicated, so I thought I would ask if any of you know of any good purging scripts / something that might help with this. As advanced as this is, it can't be uncommon. Thanks - let me know if you need any clarification! David
  3. Hi, I have a series of strings like this: <1><2><a>Test1</a> <1><2><a>Test2</a> ... I want to be able to replace <a> and </a>, without affecting what is in between the two <a> tags. I only want this to happen when <1><2> are present before <a> In other words, I can't just do str_replace on <a> and </a>, because it must match the pattern of <1> and <2> preceding the <a> tags. I'm sure this is super simple, but I'm having issues figuring out exactly what to do. Let me know if you need any clarification. Thanks, David
  4. Thanks for the reply, but I wasn't asking how to decode it. I simply can't do anything with the variable so long as it has those characters in it. I can't echo it as it is, or after doing an URLDecode on it.
  5. Hi, I have a PHP page where I'm passing in $_GET variables such as the following: page.php?st=NX-Zero---Cartas-pra-Voc%EAasd-%5BAG... %EA represents the "ê" character. So long %EA is there, my variable is inaccessible through PHP. In page.php I simply have "echo $_GET['st']" If I remove %EA then it works. "%5B" is also present in the URL, which represents the "[" character, and it causes no problems. What do you think the issue may be here? Thanks, David
  6. Edit: beat me to it.
  7. Hey guys. I'd like to create bar graphs based off of duplicate data retrieved from a MySQL db. I have a general *idea* of how this can be done, but the code itself isn't standing out to me at the moment. Here's an easy example of something similar to what I'll be doing with this: Let's say we have a form on a site where users can type a day of the week into an input box. When a user types "Thursday" - for example - and presses Go, PHP creates a row in the mysql table with the timestamp and what the user typed which is, in this case, "Thursday". Now lets say a few users enter a day of the week into the DB. Our mysql table might have values similar to this: Monday Thursday Wednesday Friday Thursday Thursday Thursday Tuesday Tuesday So - 1 monday, 4 thursdays, 1 friday and 2 tuesdays. Now, I would like to SELECT from the DB and draw out a simple CSS bar graph stating the most popular (duplicate) values from the table. It might look something like Thursday ||||||||||||||| Tuesday |||||||| Monday || Friday || Because Thursday had the most occurances, Tuesday the second, and Monday/Friday both had 1 occurance. This example is the easiest way I could come up with to demonstrate what I'm looking for. Unlike the simplified example I gave, the possible values will not be days of the week, and therefore will not be predictable. Obviously if I was just making a poll for people to choose a random day of the week I wouldn't go about it this way. I *think* the general way to go about this will involve making some sort of loop and getting variables setup to count dupes and eventually multiply the values of those counters to get percentage values to pass into a CSS div or something to represent the bar graphs. This sounds kind of tricky, but I think it is overall pretty simple, so let me know if you need any clarification. Thanks! David
  8. Hi, What kind of str_replace can I apply to take a variable, say, $artist, and everything in it to lowercase? Simple n00b question, I know. Thanks
  9. Great, that worked. Thanks a bunch I appreciate it. David
  10. Else should apply to all. Artist is set, your test does what it should. If I type three doors down as the artist, it returns the ELSE include function as though it did not see that 3 doors down was one of the variables I wanted to be changed under 'if'
  11. file_get_contents only gets text. If you use fopen() you will get images, etc... But, beware of bandwidth hogger.
  12. Well, I have this snippet of code I wrote to look at what somebody has typed into an input box and yield different results depending on what they typed. I have the following file included on my page, oddly enough, it does nothing.. It doesn't change out the specified variables if they're inputted. Even more weird, it was working for me when I was only using 2 different 'if' functions, now that I have 5 I'm not sure what happened. :-\ No errors come up either. Thanks! I appreciate it. <?php //THIS FILE IS FOR THE BAND PIC IN THE SIDEBAR //copy and paste entries to make more, just follow the patterns //you can copy any entry except for the last one to use as a template //for more, also, you cannot add these below the last entry, as that //makes it no longer the last entry. //entry 1 - if ivete sangalo is typed, this will apply. if ($artist == "ivete sangalo") { echo ' <img src=\"link to band image\">'; } //entry 2 - if rammstein is typed, this will apply. if ($artist == "rammstein") { echo ' <img src=\"link to band image\">'; } //entry 3 - if nickelback is typed, this will apply. if ($artist == "nickelback") { echo ' <img src=\"link to band image\">'; } //entry 4 - if 3 doors down is typed, this will apply. if ($artist == "3 doors down") { echo ' <img src=\"link to band image\">'; } //entry 5 - if sorriso maroto is typed, this will apply, because this is the last entry //of the list, there differences in the code, so to produce more artists to modify, never //copy and paste the last one as a template. Use any of the ones above this instead. if ($artist == "sorriso maroto") { echo ' <img src=\"link to band image\">'; }else{ include("bandpic.php?artist=$altartist"); } ?>
  13. Hi guys, On my site I use php header() functions to force downloading of .mp3 files to bypass Quicktime playing them in-browser -- the MP3 files aren't stored on my server. Now, if I just link to the MP3 and instruct them to "Save target as..." to download it, it takes none of my bandwidth, since it's on a different server, whereas if I use php header() inside of a get.php-type file to make it automatically popup a "save file" dialog, it hogs my server's bandwidth like crazy when people download! So php headers has to pipe the file through the server to the user? Either way, I can't afford this bandwidth so will just a php readfile() funct. like readfile($song->url); NOT take from my bandwidth, as opposed to; header("Content-Length: " . $song->content->length); header("Content-Type: " . $song->content->type); header("Content-Disposition: " . $song->content->disposition); Thanks guys! This forum is very very helpful and the users are friendly. David
×
×
  • 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.