Jump to content

drath

Members
  • Posts

    54
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

drath's Achievements

Member

Member (2/5)

0

Reputation

  1. For posterity sake, here is the final query I used to get this working: WHERE STR_TO_DATE(lastlogin, '%M %D, %Y %l:%i %p') >= DATE_SUB(NOW(), INTERVAL 1 MONTH) I thought I used to be able to mark the thread as solved? Either way, it's SOLVED
  2. Thanks, I was not even aware of STR_TO_DATE(). I will take a look at this and try to come up with something. Thanks!
  3. I would have the date stored in DATETIME/TIMESTAMP as noted if I had a choice
  4. MySQL Version: 5.0.32 Hello there guys, I've been stumped for awhile using DATE_FORMAT in a SELECT that I have been creating. Unfortunately the field is not in a timestamp, or a straightforward datetime format, and there is no ability to edit that, so it looks like it's DATE_FORMAT to the rescue... except it's not working (yet). The field (lastlogin) is formatted as: July 24th, 2010 2:03 PM or in PHP: date('F jS, Y g:i A'). As far as I can tell, the MySQL equivalent of that is %M %D, %Y %l:%i %p. This is my query for trying to select only the times within the last month: $sql = "SELECT snip FROM snip WHERE DATE_FORMAT('lastlogin', '%M %D, %Y %l:%i %p') >= '" . date("F jS, Y g:i A", strtotime("-1 month")) . "' ORDER BY snip DESC LIMIT 20"; Can anybody spot what I may be doing wrong here? It is not returning any error, so I assume it is at least executing, but nothing is showing up, which means I made a formatting mistake possible? Thanks! *EDIT* The PHP portion in there is confirmed working, it returns a date of the previous month in the proper format, "September 19th, 2011 6:39 PM" for example at the time of this post.
  5. I'm working on a fairly ambitious project and have a HUGE set of array values to store, edit, and call from the database. This is a general question in regards to the best way to do this. To give you an example of the size: $tile[-33][423] = "green" $tile[-99][-300] = "green" $tile[1000][30] = "brown" $tile[9][-1] = "red" $tile[10939][-2] = "brown" and so on... There will possible be millions of variable array combinations here. I was first thinking about serializing the array to store in a single field on the database. But the problem comes in when I want to edit a single tile variable, I would have to grab all the data (I think?), change one thing, put it all back - that would be pretty resource intensive, especially when I would need to make these edit calls 10 times a minute for example. So that leaves me to the only other option I can think of, which is doing a column and row approach: x y tile 100 5000 red -211 7120 green 455 2 blue and so on... But then I thought, what is the performance going to be like if go to import 5000 variables into the database in one fell swoop? Or what about when I need to grab the data from 5000 of them to output? Maybe it won't be so bad? The SELECT, INSERT functions for these 5000 variables won't be happening near as much as the single UPDATE calls, but they could still be fairly frequent - perhaps once every 10 minutes for the INSERT, once every 2 minutes for the SELECT. Hopefully that made some sense. Also, am I going to be running into any PHP/MySQL limitations here on int values, or array limits?
×
×
  • 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.