Jump to content

DarkWater

Members
  • Posts

    6,173
  • Joined

  • Last visited

    Never

Everything posted by DarkWater

  1. If you're using globals, you're most likely doing it wrong.
  2. $qryRemHosts = sprintf("SELECT removed_hosts FROM usr_preferences WHERE uid IN('$s')", implode("', '", $uid)); Try that. Also, I don't like what you're doing with $arrLastServices. That loop seems pointless and inefficient.
  3. That's not a prepared statement, by the way; that's just using a variable... Try something like: $sql = "SELECT email FROM $table"; $result = mysql_query($sql) or die(mysql_error());
  4. echo preg_replace('~<img src="(.+?)" />~is','[_img]$1[/_img]',$text); There you go; that should work.
  5. @sam06: Use flyhoney's method. In the one you have now, you're doing the query twice. That wastes resources and it absolutely pointless. EDIT: Also, mysql_result() is pretty slow compared to the other fetching functions. Use one of those as opposed to mysql_result().
  6. <?php $string = "Shows"; $string = rtrim($string, 's'); echo $string; ?> If you want a more comprehensive solution that will strip ANY word of a trailing 's': <?php $string = "Here, we have some words with letters on the end. Enjoy the shows!"; $string = preg_replace('/([a-z]+?)s(?=\s|(\b.)?$)/i', '$1', $string); echo $string;
  7. I think you don't understand what a query string is. It's completely an HTTP thing and the web server handles it. When you include the file, you can simply set the variables before including and they'll be available in the included script; no need for $_GET.
  8. Traditionally, 'void', when used in function headers, means that nothing gets passed in. Not sure why it says "optional" next to it on W3schools. Regardless, the PHP manual is the best source to rely on for these function prototypes.
  9. Why were you passing a string literal containing 'void' into time()?
  10. You don't need regex for this. <?php $field_name = "username_required"; if (strpos($field_name, "_required") !== FALSE) { //it's there } else { //nope }
  11. mysql_real_escape_string() escape more than just quotation marks. It escapes anything that could potentially confuse MySQL and break your query.
  12. Why are you looping through the table instead of just using a WHERE clause on your query?
  13. No. You're making that WAY harder than it has to be: $mysql = "Select * from "; $mysql .= "Person "; $mysql .= "Where Name like '%$SearchA%'"; . is the concatenation operator as opposed to +. Use . where you would normally use + and you'll be fine.
  14. @Maq: The string is in double quotes. It doesn't matter that the variables happen to have ' ' around them in the double-quoted string; they'll still interpolate.
  15. The point of OOP is not to just simply wrap procedural code into a bunch of static functions. You might as well just have getLastUpdate(), getHosts(), etc. just as functions if that's how you're going to do it. OOP allows you to emulate real-world objects and relations and structure your code around that.
  16. http://www.google.com/search?ie=UTF-8&oe=UTF-8&sourceid=navclient&gfns=1&q=website+monitoring Because THAT was hard.
  17. 3/5 computers in my house are on all day, every day. The other 2 are laptops, so it would be kind of dumb to leave them on. I have a backup power supply on my main box for blackouts, so it's REALLY always on.
  18. I used arsort(), which maintains key=>value pairs and sorts by value.
  19. <?php $arr = array(999, 1000, 998); print_r(arr); arsort($arr, SORT_NUMERIC); print_r($arr); ?>
  20. Check out the MySQL NOW() function to get the current time.
×
×
  • 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.