Jump to content

spiderwell

Members
  • Posts

    1,008
  • Joined

  • Last visited

Contact Methods

  • MSN
    spiderwell@hotmail.com

Profile Information

  • Gender
    Male

spiderwell's Achievements

Member

Member (2/5)

1

Reputation

  1. ok still working on this, I am now at this point, were i want to just have a week span from today, so 15march back to 8th march, but any year WHERE DAYOFYEAR(item_date) <= DAYOFYEAR(NOW()) AND DAYOFYEAR(item_date) >= DAYOFYEAR(NOW()-7) ORDER BY MONTH(item_date), DAY(item_date) DESC it works with 1 WHERE parameter, i.e. less than today, but not with both, I also tried using BETWEEN instead of <= >= and it made no difference. thanks
  2. ok so this works well, but how do i get it to work backwards from todays date, i.e 15th march
  3. I havent really looked at it properly but if a checkbox is not checked it doesnt turn up in the post array (i think) and this might have some consequence to your methods when processing the data, have you tried checking everybox to see if that works correctly?
  4. Hi all I have a datetime field on my database table, and the rows have dates of events over the last hundred years, and I want to somehow order by month and day from todays date but ignore the year, so i guess that is a group by daymonth type thing. the idea being when you hit the page, you will see anything that happend on this day but in any previous years too, and then work backwards in day/months. so say i had 3 dates, a)1st april 2013 b)1 march 2005 c)1st april 2000 the desired order would be a,c,b , if the query was run on 1st april, but if it was run on 1st march the order would be b,a,c. I hope that makes sense. I tried this: GROUP BY DAYOFMONTH(item_date) ORDER BY `item_date` DESC which gets the order correct, but i then need it to associate with current date, so i tried this but it just threw me an empty record set: WHERE DATE(item_date) = DATE(NOW()) GROUP BY DAYOFMONTH(item_date) ORDER BY `item_date` DESC anyone have any pointers or ideas?
  5. ok so having tried Barand's solution i end up with a set of results that is twice as many columns as i need, it gives me both sender and receipient user details, which basically means each row has sender details and the recipient details, only sometimes my details are on sender and other time on receipient. Is there anyway to acheive this without it putting both user details into every row ? other wise i am repeating userid = 1 details on every row of the result. Im sure there is a more effcient way to do this?
  6. poster one: many thanks poster two: yeah yeah i know
  7. hi all, i have 2 tables, one is a users table, it has the usual expected fields, but for now all you need to know is user_id is the auto increment PK for that table. My second table is called 'contacts' and has this structure: CREATE TABLE IF NOT EXISTS `contact` ( `contact_user_id` int(11) NOT NULL, `contact_contact_user_id` int(11) NOT NULL, `contact_status` enum('Request','Confirm','Deny','Follow','Block') CHARACTER SET utf8 NOT NULL, `contact_date` datetime NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; the contact_user_id is the sender of the contact request, and the contact_contact_user_id the receipent , the idea being its a list of contacts for a user in the database. now to get a list of contacts for a given user I used this sql for userid = 1: SELECT * FROM (`contact`) WHERE `contact_contact_user_id` = '1' OR `contact_user_id` = '1' AND `contact_status` != 'Block' I want to left join users table on to these results, but the column which that user is in can be either of the 2 columns mentioned above as here is a result set 1 47 Request 2013-02-08 17:33:20 1 45 Confirm 2013-02-08 17:33:31 48 1 Confirm 2013-02-08 17:33:40 49 1 Request 2013-02-08 17:34:34 1 46 Request 2013-02-08 17:41:17 how would i join my user table to one of 2 columns in the contacts table, and ensure im not joining my user details instead of the contacts?
  8. well 90million is a figure i pulled out of thin air, as a top end example, personally if we get 1k users i'd be impressed, I shall do some more research on hashed directory structure, as it isnt an area i have any experience in
  9. having looked at that article, and links to others in it, it seems that i do not want to go to deep, but i think i wont with the system i came up with, if i had 90 million users, the structure would be 8 folders deep. but i am a bit niave on things like this, perhaps that is too deep already?
  10. yeah my buddy was on this last weekend, playing the 1 hour beta thing. looked great, but then i havent seen this game proerply in over 15years and it was very different then!.
  11. aha great stuff, thanks Christian, i shall peruse that link now
  12. this is what i have come up with, its does the splitting of up of a userid into each character and turns that into a path, and then adds a folder which is named from the user id for instance user with id 12345 gets a path of /upload/1/2/3/4/5/12345. define('UPLOADS_FOLDER', './upload/'); function make_user_upload_path($userid) { //create a path for the user for uploading if(strlen($userid) == 1) { if(!file_exists(UPLOADS_FOLDER . $userid)) { mkdir(UPLOADS_FOLDER . $userid,0777,true); } return UPLOADS_FOLDER . $userid . '/';//add trailing slash } else { $arrTemp = str_split($userid); $newPath = implode('/',$arrTemp); if(!file_exists(UPLOADS_FOLDER . $newPath . '/' . $userid)) { mkdir(UPLOADS_FOLDER . $newPath . '/' . $userid ,0777,true); } return UPLOADS_FOLDER . $newPath . '/' . $userid . '/';//add trailing slash } } i think maybe i am splitting it up too much, maybe only split upto 3 or 4 characters would be enough?
  13. ah yes, I think I came across that once before, about max number of files per folder, but it has slipped to the back of my mind!
×
×
  • 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.