I have a query that looks like this: I want to increment the value as easily as possible. I have tried: I don’t get error messages, but the value in my db does not increase either. Answer If you use the single quotes ‘, you’re telling the enclosed value to be interpreted as a string You were…
Tag: php
Create link in PHP with Get Parameters
This page is quite configurable with different parameters. So, it may be called like: Now my question is, what is the idiom for generating a link to the current page but with one parameter changed? For example, I’d like to change foo to 5, what’s the easiest way to generate a link like: I can loop…
NetBeans always shows warning: “The authenticity of host x can’t be established” after upload, download or synchronize
I’m currently using NetBeans 6.9 with the PHP plugin and a PHP Application from Remote Server project. However, every time I upload or download with it, I’m prompted with a warning that reads: The …
Execute raw SQL using Doctrine 2
I want to execute raw SQL using Doctrine 2 I need to truncate the database tables and initialize tables with default test data. Answer I found out the answer is probably: A NativeQuery lets you execute native SQL, mapping the results according to your specifications. Such a specification that describes how an…
Is an X-Requested-With header server check sufficient to protect against a CSRF for an ajax-driven application?
I’m working on a completely ajax-driven application where all requests pass through what basically amounts to a main controller which, at its bare bones, looks something like this: if(strtolower($…
Static class initializer in PHP
I have an helper class with some static functions. All the functions in the class require a ‘heavy’ initialization function to run once (as if it were a constructor). Is there a good practice for achieving this? The only thing I thought of was calling an init function, and breaking its flow if it has already …
Replacing a specific part of a query string PHP
I use $_SERVER[‘QUERY_STRING’] to get the query sting. A example would be a=123&b=456&c=789 How could I remove the b value from the query string to obtain a=123&c=789 where b can be any value of any length and is alpha numeric. Any ideas appreciated, thanks. Answer The value is going t…
Which regexp php is using for filter_var($url, FILTER_VALIDATE_URL)?
filter_var($url, FILTER_VALIDATE_URL) seems to be great way to detect if $url contains url or not. Is there any way to see what regular expression this function uses for detecting? Thank you
How to use Visual Studio for WordPress development?
Does anyone use Visual Studio to do WordPress development? If so, how do you do it?
Preventing JavaScript Injections in a PHP Web Application
What are the measures needed to prevent or to stop JavaScript injections from happening in a PHP Web application so that sensitive information is not given out (best-practices in PHP, HTML/XHTML and JavaScript)? Answer A good first step is applying the methods listed in the question Gert G linked. This covers…