Jump to content

trq

Staff Alumni
  • Posts

    30,999
  • Joined

  • Last visited

  • Days Won

    26

Everything posted by trq

  1. You can easily make a JavaScript function overwrite itself: var foo = function() { alert('say foo'); foo = function() { alert('never again say foo'); } } foo(); foo(); foo(); The first time you call foo() it will display 'say foo', every other call after that will display 'never again say foo'.
  2. You can send arrays through post and get using a syntax such as: <input type="text" name="foo[]" /> <input type="text" name="foo[]" /> <input type="text" name="foo[]" /> The value of the fields would show up as an array within the $_GET or $_POST arrays depending on your forms method. Yes, you can send it as json then use php's json_decode to turn it into a php array. As for the rest of your question. It sound more like your stuck with how to format the JavaScript to send to PHP. This is a JavaScript issue and doesn't belong in this board.
  3. Variables do not need to be surrounded by quotes. The error means that $arr_read_messages is not an array.
  4. $this refers to the current object. So, if $this->cusomlib works within your controller then customlib is a property of the controller. I'm not a codeignitor user but I suggest you take a look at how to create view helpers if you want access to your functionality from within the view.
  5. Functions should not rely on global vars. You should pass the value into the function: function foo($name){ echo $name; } foo($_SESSION['ex_name']);
  6. Yeah, this looks like a bug in SMF.
  7. As I said in my previous post. One server likely has notices hidden, this doesn't mean they don't exist. You should fix the code. You should always check an index exists before attempting to access it.
  8. That is still a coding issue, not a configuration one.
  9. Unless you configure your server to serve .html files via the php interpreter.
  10. That notice is caused by poor programming, not any PHP setting. You can configure PHP to hide notices but your much better off fixing the code itself.
  11. This topic has been moved to PHP Applications. http://www.phpfreaks.com/forums/index.php?topic=339538.0
  12. PHP supports two kinds of quotes for a reason. It's not the only language to do so. Single quotes accept literal strings and do no interpolation on the contents within them. Double quoted string are interpolated however, meaning variables are parsed. eg; $foo = 'thorpe'; echo "Hello, my name is $foo, what's doing?"; Also note that single quotes can appear in double quoted strings (as shown above), and double quotes can appear in single quoted strings without needing to be escaped.
  13. This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=339495.0
  14. mysql_query("SELECT * FROM Text WHERE Key='$key' && status = 1");
  15. This topic has been moved to Third Party PHP Scripts. http://www.phpfreaks.com/forums/index.php?topic=339429.0
  16. We need to see your current code. if you haven't changed your code since your first post you need to re-read the replies already given.
  17. Check your curly braces. Simple syntax errors should not require the help of a forum. If you still can't find the error, post your current code.
  18. Please, we have tags for use when posting code. Now, are you asking for help with PHP or Javascript? This is the PHP Help board, yet there doesn't appear to be much PHP in your code.
  19. Integers are not quoted in php (or any other languages I know of). As for your issue, what debugging have you done? You haven't checked your query has succeeded or returns any results.Have you tried simply echoing the results within all the string replacing? Also, opening a mysql connection like that within a loop is never going to be a wise idea.
  20. This topic has been moved to PHP Coding Help. http://www.phpfreaks.com/forums/index.php?topic=339423.0
  21. $menus is obviously not an array or object. Where do you define it?
  22. You can simply an instance and then pass it to User (which is what you are already doing anyway). This way it's easier if you need to use A in multiple objects. $a = new A('localhost','root','pass','db'); $user1 = new User($a); This is generally the simplest option. The above example is dependency injects at it's simplest. There are however more flexible (and more complex) patterns you can use. Google 'PHP Dependency Injection' and you should find some tutorials. There is also a decent library floating around these days from the guys who wrote Symfony. It's well worth taking a look at even if you don't end up using it.
  23. I don't think you can go past atlassian's products, there miles ahead of anything else out there IMO.
×
×
  • 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.