Jump to content


  • Posts

  • Joined

  • Last visited

Everything posted by spiderwell

  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!
  14. thanks for the feedback, i guess thats a composite pk? i think thats the phrase, where there is a PK from combination of 2 columns, so you cant end up being friends twice. would your example of folders and files mean that i might end up with many folders/paths only leading to 1 file in a folder? would that not lead to having twice as many folders as there are files?, and if so I am not sure what implication this would have on performance, if any.
  15. Hi All, I have recently started a new role and its just me as developer, and the site is a social network, not a facebook rival, i might add . However when it comes to the design, i was not having much luck researching online for a few areas, and hope that some of you might be able to point me in the right direction of design tutorials or just articles about such subjects. Uploads Obviously this is the one thing all social networks need, and I am wondering the best way to go about storage. I was planning on using the filesystem for storing physical files such as images/pdfs, rather than put in the database (text entered in browser will be stored in this way). Is there a best practicise for storage techniques, I am thinking of having a folder with the same name as the user_id for all the uploads to go into, and then if i resize any images, they will be generated on the fly and stored in a cache folder. Would this be the correct way to do this, as I cant imagine stuffing it all into 1 folder makes any sense. Perhaps i could take user folder to have folders for each upload type images/pdfs/doc etc. Connections Now this is the fun bit, I again have been researching but not really found any articles that give me the bones and meat of what to do here from a database table structure view or just concept design. My first thoughts are a table for friends which is just a look up of user ids essentially, that would be 3 columns, id PK col, user_id, friend_id , perhaps a date column, and confirm friend column too. At this stage these are the only points that I am trying to work out, I am not looking for a coded answer, I like to be pointed in the right direction and then do the work myself, so anything that might be useful, please let me know! Many Thanks in advance Nick
  16. hey thanks for the reply on this, sorry i didnt spot it earlier!!
  17. its for a website that has a shop, and i have to check stock levels on checkout, and to do that i have to use SOAP to contact the service, if the service is unavailable I want to be able to display a friendly message not have the 503 response which is what i get if i try and make the soap connection when the server is unreachable. I am trying to find a way to avoid this so that the website doesnt look like it has crashed because i cannot reach the remote server via SOAP. Yes I am trying to reach WSDL, the client URL is like this: 'https://999.999.999.999/censored.exe/wsdl/IKosWeb', I should have put that in from the start, my apologies, I didnt realise that part was important, my SOAP knowledge is not up to much sadly. The soap exceptions are caught by my code, its just when i try and create the soapClient and the server is unreachable that it doesnt get caught. I am doing this on purpose as I want to be able to cover the situation should it arise.
  18. with a slight adjustment $this->client = new SoapClient($this->clientUrl, array('exceptions' => true)); but i am not on 5.4, i have 5.3 and it still does the same thing gives A PHP Error was encountered Severity: Warning Message: SoapClient::SoapClient(https://999.999.999.999/censored.exe/) [soapclient.soapclient]: failed to open stream: HTTP request failed! HTTP/1.1 503 Service Unavailable Filename: models/khaos_model.php Line Number: 13
  19. Hi all, I hope you can help me out on this one, I am writing a class that uses soap to fetch data from a server but it gives me a 503 error when the server is not reachable, I am trying to catch it but it doesnt seem to be working: here is what I have so far, please note that i havent not put in the rest of the class so assume the rest is all good below the __construct() method as it is when the service is working and the SOAP errors are getting caught fine with this code, but the Service Unavailable i suspect cannot be caught? Is there another way i can approach this to achieve the same goal? class Khaos_model extends CI_Model { public $clientUrl = "https://999.999.999.999/censored.exe/";//obviously changed for forum public $client = false; public $connection = false; public $connectionerror = false; public function __construct() { parent::__construct(); try { $this->client = new SoapClient($this->clientUrl); $this->connection = true; } catch (SoapFault $fault) { $this->connectionerror = "SOAP Fault: (faultcode: {$fault->faultcode}, faultstring: {$fault->faultstring})"; } // } Many Thanks
  20. yes the form posts to products/search but it seems to redirect to products/index
  21. Happy New Year everyone! OK so I am sure my problem is easily resolved, but it isn’t obvious to me so maybe one of you experts can help. I have a controller called products, with a bunch of methods, index shows all products by category, there is a method azproducts does the same thing but groups by letter, then i have a search method also. then each product has its individual view in the view method. here are my routes: $route[‘products’] = ‘products’; $route[‘products/addtobasket/(:any)’] = ‘products/addtobasket/$1’; $route[‘products/view/(:any)’] = ‘products/view/$1’; $route[‘products/azproducts/(:any)’] = ‘products/azproducts/$1’; $route[‘products/search/(:any)’] = ‘products/search/$1’; $route[‘products/(:any)’] = ‘products/index/$1’; Now I think the issue is to do with the bottom line, as if I remove ‘index’ from $route[‘products/(:any)’] = ‘products/index/$1’ it returns with a 404, but if i leave it in, it works. However with it left in, the search page then fails to work and routes to the index method instead. does anyone have any ideas what I am doing wrong? I have posted this also on EllisLabs Codeigniter forum, but I think this site has better 'footfall' Thanks
  22. yes drag out does seem like a good idea! I hadn't even thought of that. pikachu2000 - its just trying to explain how to use the site
  23. can you explain a bit further, (browser type) you should be able to remove by hitting refresh
  • 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.