Jump to content

scootstah

Staff Alumni
  • Posts

    3,858
  • Joined

  • Last visited

  • Days Won

    29

Everything posted by scootstah

  1. You can use str_word_count, and remove any punctuation first. function count_words($description) { // remove punctuation $punctuation = array('.', ',', '!', '?', ':', ';', '(', ')'); $description = str_replace($punctuation, '', $description); return str_word_count($description); }
  2. You could use closures, or create_function
  3. You can use the this keyword to target the input that called the function. Here's an example: http://jsfiddle.net/wnDPn/
  4. Does your router have wireless? You should be able to just configure it to act as a switch to distribute the wireless signal.
  5. Whoops, didn't notice it was in a foreach loop. Which by the way is very inefficient design. You should be able to use this code to run the same query outside of the foreach loop, so you have one query instead of 10. $cookie = array_slice($_COOKIE['jimbean'], 0, 10); $where = array(); foreach($cookie as $c) { $where[] = "'$c'"; } $where = implode(', ', $where); $this->obDb->query="SELECT vTitle FROM ".PRODUCTS." WHERE vSeoTitle IN($where) LIMIT 10"; Also, depending on how your database class works this may be susceptible to SQL injection.
  6. Prepared statements make the query safe internally, so you do not have to worry about SQL injection.
  7. $this->obDb->query="SELECT vTitle FROM ".PRODUCTS." WHERE vSeoTitle = '".$value."' LIMIT 10";
  8. You can mix PHP into HTML by either echoing HTML or putting HTML outside of the PHP tags. You can also use more than one set of PHP tags, and use PHP tags anywhere inside of HTML (including attributes and such).
  9. Safest for what?
  10. Wouldn't that make the drive really hot during operation?
  11. You could always encrypt the data and then throw it in a safety deposit box, or store it at a friend's/relative's house.
  12. Only to 2008? Well, that's only a small shit-ton then.
  13. I would imagine you'd experience a small amount of downtime, for the time it takes DNS to propagate.
  14. 313 / 3600 (seconds in an hour) = 0.0869444444 hours Not sure where you got .12 from.
  15. There are plenty of free services out there or at least trial periods: http://www.justcloud.com/ If it's sensitive enough that I need to store it off-site, I probably don't want it on some free service.
  16. That's why I try to make it a habit to quote anything in question, that way they can't tamper with it.
  17. I believe Dreamweaver also has a formatting feature, though I'm not positive on that.
  18. I agree. For home use though, I don't think too many people go to this extreme. Personally, I have my sensitive data (passwords and such) on multiple systems in my home, as well as my phone. The files for my local dev server throws partial backups on my main PC daily, and full backups weekly. I may look into some cloud storage in the future, but I don't have any spare money for it right now.
  19. This one seems to do what you want: http://beta.phpformatter.com/
  20. Fair enough. It's just that there is a very big misconception that a mirrored array is all you need to keep your data safe. True, the redundancy from a mirrored array is still better than relying on a single drive (or multiple standalone disks). Preferably to a backup drive that's in another machine.
  21. RAID IS NOT an alternative to proper backups.
  22. You have more chances of a drive failing if you have four than you do with one. Disk quantity really has nothing to do with data security. Even if you have four 500gb drives, any of them could fail losing all of that data.
  23. I think a better approach would be to use a "min" and "max" price, and use MySQL's BETWEEN operator.
  24. It depends on what the comments are for. If they are just article comments when everyone is just saying "awesome article thanks", it's not really needed. But for forums or some such, as an end user I much prefer the ability to edit my posts. Especially on help/support forums (such as this one). Often times you don't notice a mistake or typo until after you've posted, which is then irritating if you can't edit it and fix it. So in short: an edit feature is a lot more convenient for the users, but more of a pain for the developer. Also, if you plan on parsing BBCode (or some other format) I would recommend you either have a preview function, or an edit function. Or both.
  25. When you save the bid, just update the date that is saved in the database. Here's a quick example... // get item id $item_id = $_POST['item_id']; /* * ... code to save bid ... */ // update items remaining time $query = "UPDATE items SET time_left = time_left + INTERVAL 15 SECOND WHERE id = '$item_id'"; mysql_query($query); Then you can use Javascript/AJAX to change the time shown on screen.
×
×
  • 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.