Jump to content

Maq

Administrators
  • Posts

    9,363
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by Maq

  1. 'To' is a reserved MySQL word. You either have to use backticks `to` around it every time you use it, or rename that column.
  2. Heh, I agree, let us know how it goes.
  3. I would try and get into contact with the source you got this from. They should have provided a .sql file for you to build the entire DB structure. I would not want to even try to build a DB from the queries in the script and, AFAIK, there is no automatic way to do this.
  4. I assume this is a 3rd party script you're using. You didn't receive a database definition or anything?
  5. That's the correct way to do it. Are you positive the account doesn't have 1 as a value for beta?
  6. There's always an elegant string function solution.
  7. The site looks nice but the load time is pretty long. I suggest running YSlow while your page loads to see what you can do to speed it up. You have 121 HTTP requests.
  8. You need the dollar sign directly next to your variable name. It thinks displayName is a constant. If it is, please read the manual: http://php.net/manual/en/function.constant.php
  9. If it doesn't match print out the original text or whatever you please: $subject = "word1-word2-word3"; $pattern = "/(\w*-){4}\w*/i"; if(preg_match($pattern, $subject, $matches)) { echo $matches[0]; } else { echo $subject; } ?>
  10. I don't think many people are going to go through 54kb and 8kb worth of code. If you post specific examples then we could easily help you. There are general rules of thumb to optimize code. Do a search on here for some useful tips, here is a recent thread: http://www.phpfreaks.com/forums/miscellaneous/how-to-optimize-a-php-script/msg1514604/#msg1514604
  11. You're changing the code, at first you didn't have the comma, now you have: '%s ha%s been kicked.', Are you sure this is your current code?
  12. As I tried, this returns nothing. Works fine for me. Did you implement this with other code? Also, to get rid of the last dash, change the regex pattern to: $pattern = "/(\w*-){4}\w*/i";
  13. I think you meant for this line to be: sprintf('%s ha%s been banned ' . not: sprintf('%s ha%s been banned.'
  14. Maq

    Mysql 5.5

    Most of these questions can be answered at: http://dev.mysql.com/tech-resources/articles/introduction-to-mysql-55.html
  15. You can also use regular expressions. This way would also be a bit more dynamic if you ever want to change requirements: $subject = "word1-word2-word3-word4-word5-word6-word7"; $pattern = "/(\w*-){5}/i"; preg_match($pattern, $subject, $matches); echo $matches[0]; ?>
  16. This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=322158.0
  17. (I put tags around your code, please use them next time [your format is really spaced out BTW])
  18. This topic has been moved to PHP Regex. http://www.phpfreaks.com/forums/index.php?topic=322151.0
  19. What OS?
  20. Your query is most likely failing, please change this line to: $get_cat = mysql_query("SELECT * FROM categories WHERE Short Name = '$cat'") or die(mysql_error());
  21. Not to impose, but may I ask why you want to do this anyway?
  22. This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=321890.0
  23. $('.delete') The dot refers to class, you should use # instead for ids: $('#delete')
  24. This topic has been moved to mod_rewrite. http://www.phpfreaks.com/forums/index.php?topic=321891.0
  25. There you go, use jcbones's. A solution utilizing string functions is better. But just in case you were wondering, to make the regex solution work with multi lines you would change this line to $pattern = '/(.|\s)* tim/m'; The 'm' modifier indicates, multiline and the pattern accepted one or more any char along with \s (any whitespace character [carriage return, line feed, space and tab]).
×
×
  • 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.