Jump to content

optikalefx

Members
  • Posts

    363
  • Joined

  • Last visited

    Never

Everything posted by optikalefx

  1. I know this won't be possible with DOC, but it should be with DOCX. Basically I want to have someone write up a docx file using special tokens in certain places. Then my PHP would find and replace those tokens when the users needs to. It would create and serve a NEW docx file with the tokens replaced. Any ideas on this? I'm reading up on a ton of libraries, but nearly all of them, their examples don't work out of the box. Thanks!
  2. Your stealing a game thats meant to run within the walls of facebook.
  3. sure np. A little extra tip. For yes or no type storage, you should really use TINYINT(1) and store 1 or 0 instad of yes or no. Your database will be smaller and all your code will be simpler. Instead of checking WHERE blah ='yes' you will be able to just do WHERE blah. and if you want to display yes or no, you can do that with SELECT IF(blah,'yes','no') as blah
  4. Seriously - just calculate the end date and store that. There is an awesome mysql date function called DATE_DIFF that you can use in all your selects to return the duration without ever going to PHP. If you REALLY wanna store duration, you need to store a concatted string. 1:Y would be 1 Year. and you can use Y from the php date functions. So in PHP you would explode(":","1:y") to get that as an array. Or just store 2 fields. Either way you should just store the end date.
  5. Couldn't you use IF as well? $q1 = "UPDATE Events SET HPselected = IF(ID IN ( '{$eID}', '{$eID2}', '{$eID3}'), 'yes' , 'no')";
  6. replace would replace all of them. Which should be fine for your case. Paste the code you couldn't get to work.
  7. Again don't store the duration. calculate the end date in PHP and store that. The logic is much more refined that way.
  8. Thanks! that gave me the list. Now I think I can write a script to use this data to determine if a duplicate should be delete or not, and then i can finally unique the table. woot!
  9. SELECT Sales.*, otherTable.USQuantity, otherTable.USDollars, otherTable.MXQuantity, otherTable.MXDollars FROM Sales LEFT JOIN otherTable ON (Sales.Product = otherTable.Product) basically your using the Product field on both tables to JOIN those 2 tables together. Left join means i dont care if the join results in null values, just give me the row no matter what. JOIN alone (without the left) would do the same but not give you the row if the key did not exist on the other table.
  10. you don't have a database named "examples". double check all your spelling.
  11. Store the start and end date. If you want to adjust the duration, just adjust the end date. Because in reality that is what changing the duration means, it means its going to end later, or end sooner. Again using date_sub to figure out the actual duration if you want to know that specific information.
  12. Knowing the primary keys of each row you want to update - you can use REPLACE to do multiple Updates just like you would use INSERT to do multile inserts. REPLACE INTO table (primaryKeyColumn, col2, col3) VALUES ('primaryKeyValue','val2','val3')
  13. Well a primary key already exists, this is another field. Basically the user_id is the primary unique key. But there are duplicate usernames. and right now people have duplicate usernames. I want to somehow purge all duplicates.
  14. Ok, can you explain why that worked? I put an index on userpermissions.UserID and now it works. So... why?
  15. if you were 100% that it will never be a many to 1 relationship than an 'answer' is just a property of a question. Therefore it can just be a field on the question table. But you also have to ask, will there ever be information about an answer that isn't directly about the question? Like, how long it took to answer that question, what order the answer appeared in, etc.. That all could still be on the question table, but you wanna make sure that an answer is just 1 piece of info about a question and it isn't an entity of its own.
  16. So the reason you want them all as separate tables is because what if you have multiple answers to 1 question. Now what? Now you have a 1 to many relationship that you need the questions and answers table for.
  17. Well now that i understand what its telling me - this result makes sense. It is a 1 to many relationship. Its not the left join alone that is causing the problem. Its left joining with the aggregate function like count or group by that is causing the issue.
  18. Thats odd. users is type: index key: Primary key_len:4 rows: 16016 extraL Using index: using temporary; using filesort userpermissions however has type: all key:null rows: 27000 But i have a primary key auto increment set on the table... I wonder why none is showing up here... hmm
  19. I have a users table, and I have a table of videos that a user has permission for. So there are many rows in the permissions table for 1 user. I want to show all user info including a count() on the number of videos for all users in 1 list. doing select * from users works fine of course. but doing select users.UserID, COUNT(userpermissions.`UserPermissionsID`) FROM users LEFT JOIN userpermissions ON (userpermissions.UserID = users.UserID) GROUP BY users.UserID LIMIT 200 hangs and never finishes. Even with a limit of 1. There are 16,000 users and 27,000 total permissions. What does work - kind of. Is doing JOIN instead of LEFT JOIN. But that obviously won't grab users that have no videos. So what can i do to make the LEFT JOIN query work? Do i have an index problem? Or are these tables too large for the left join?
  20. It does not have a unique index already, but the goal of this is to add a unique index. That way these duplicates can never happen again. I want to do this to another table as well that needs a unique index based on 2 fields.
  21. Turns out I needed to make my FQDN correct. And hotmail had my site blocked. Now email is much better.
  22. So i'm taking over a big database for a client. I really need to make a unique index on the table, but I can't because there are already tons of duplicates from bad design in the past. What is a quick way to kill all these duplicates so I can set the unique index?
  23. I know there has got to be some server config somewhere. But I have a site with about 8000 users. And 20% or so can never receive "forgot email" passwords. A lot of them checked their junk and its not there, it just never gets delivered. But for a lot of people it works fine. So... How can i get PHP mail() to work better. Right now im using swift mailer with this code function email($to,$subject,$body,$from="") { require_once 'packages/swift/swift_required.php'; $transport = Swift_SendmailTransport::newInstance('/usr/sbin/sendmail -bs'); $mailer = Swift_Mailer::newInstance($transport); $message = Swift_Message::newInstance($subject); $message->setFrom($from); $headers = $message->getHeaders(); if (!$headers->has('Reply-To')) { $headers->addTextHeader('Reply-To',$from); } if(!is_array($to)) $to = array($to); $message->setTo($to); $message->setBody($body,'text/html'); $result = $mailer->batchSend($message); $toString = implode(",",$to); $this->_log("EMAIL to $toString - $body - $result"); return $result; } What have you guys used for this kind of thing? Is there some server config everyone should do? Thanks!
  24. yep just add a field to your database. then add a <input type="file" name="database_field_name"/> and then you need to just add the new filename and location (once its uploaded and moved - follow the tutorial) to your database table.
×
×
  • 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.