trq
Staff Alumni-
Posts
30,999 -
Joined
-
Last visited
-
Days Won
26
Everything posted by trq
-
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'.
-
Updating mysql table info with js array on reload
trq replied to spenceddd's topic in Javascript Help
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. -
Variables do not need to be surrounded by quotes. The error means that $arr_read_messages is not an array.
-
$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.
-
Functions should not rely on global vars. You should pass the value into the function: function foo($name){ echo $name; } foo($_SESSION['ex_name']);
-
Yeah, this looks like a bug in SMF.
-
configuring php.ini for a hosting environment
trq replied to kade119's topic in PHP Installation and Configuration
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. -
configuring php.ini for a hosting environment
trq replied to kade119's topic in PHP Installation and Configuration
That is still a coding issue, not a configuration one. -
Unless you configure your server to serve .html files via the php interpreter.
-
Let me get my crystal ball.....
-
configuring php.ini for a hosting environment
trq replied to kade119's topic in PHP Installation and Configuration
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. -
Single or double quoted strings in PHP/HTML (" and ')
trq replied to skew's topic in PHP Coding Help
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. -
mysql_query("SELECT * FROM Text WHERE Key='$key' && status = 1");
-
This topic has been moved to Third Party PHP Scripts. http://www.phpfreaks.com/forums/index.php?topic=339429.0
-
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.
-
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.
-
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.
-
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.
-
$menus is obviously not an array or object. Where do you define it?
-
Database Abstract Class, MySQL Child Class, passing login details
trq replied to MasterACE14's topic in PHP Coding Help
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. -
I don't think you can go past atlassian's products, there miles ahead of anything else out there IMO.