A lot of people are wondering why date/time functions are working differently in PostgreSQL 7.2 and up. For example queries like the following no longer work:
CODE:1
SELECT id FROM orders
WHERE interval(current_timestamp - order_date) < interval('1 month');
INTERVAL is really not a function. It is a datatype and an operator. In earlier version of PostgreSQL, you were allowed to 'sort of' use it as a function, but that no longer exists. Instead, try to either:
CODE:2 cast your value to an interval datatype:
SELECT id FROM orders
WHERE (current_timestamp - order_date) < ('1 month')::interval;
CODE :3 you can use the "interval" keyword as an operator to a timestamp representation:
SELECT id FROM orders
WHERE (current_timestamp - order_date) < (interval '1 month 3 days');
CODE :4 it works with parentheses if you remove any ambiguity about the parentheses. (Meaning: if you need parentheses for your expression, then put "interval" in quotes:
SELECT id FROM orders
WHERE (current_timestamp - order_date) < ("interval" (current_timestamp -
(SELECT order_date FROM orders WHERE id = 2)));
Flipkart
Wednesday, May 26, 2010
Friday, May 21, 2010
Cakephp Cheet Sheet
Here you can find the Cakephp cheetsheet.
http://cakephp.org/files/Resources/CakePHP-1.2-Cheatsheet.pdf
http://cakephp.org/files/Resources/CakePHP-1.2-Cheatsheet.pdf
Wednesday, May 19, 2010
Check Browser Compatibilty in Online
Now you can check your web design in different browsers on Browsershots.It is a free open-source online service.And you can send those screenshots to your mail also.
URL:http://browsershots.org/
URL:http://browsershots.org/
Tuesday, May 18, 2010
Google Search for Your Site
Integrating search on a website can be an incredibly complex subject far beyond my web development skills. Fortunately, Google offers a service called “Custom Search Engine” which you can integrate right into your own site. This leverages Googles awesome search power, and it can all happen directly on your own website!
URL: http://www.google.com/cse/
URL: http://www.google.com/cse/
Check/Uncheck Checkbox Jquery
<script type="text/javascript" language="javascript">
$j(document).ready(function () {
$j('#checkboxToggle').click(function () {
$j("input[type=checkbox]").each(function () {
if (this.checked == true) {
$j("input[type=checkbox]").attr('checked', false);
}
else {
$j("input[type=checkbox]").attr('checked', true);
}
});
});
});
</script>
---------------------------------------------------------------------------------------------------
IN JS
---------
$j(document).ready(function () {
$j('#checkboxToggle').click(function () {
$j("input[type=checkbox]").each(function () {
if (this.checked == true) {
$j("input[type=checkbox]").attr('checked', false);
}
else {
$j("input[type=checkbox]").attr('checked', true);
}
});
});
});
</script>
---------------------------------------------------------------------------------------------------
IN JS
---------
<html> <head> <script language='JavaScript'> checked = false; function checkedAll () { if (checked == false){checked = true}else{checked = false} for (var i = 0; i < document.getElementById('myform').elements.length; i++) { document.getElementById('myform').elements[i].checked = checked; } } </script> </head> <body> <form id="myform"> <input type="checkbox" name="foo"/> <input type="checkbox" name="bar"/> <BR>Check all: <input type='checkbox' name='checkall' onclick='checkedAll();'> </form> </body> </html>
Wednesday, May 12, 2010
MYSQL:Get Current Date Records from TIMESTAMP
SELECT your_columns FROM your_table WHERE DATE(date_posted) = CURDATE();
Wednesday, May 5, 2010
Codeigniter in PHP 5.3
First, here’s how to solve the issue regarding these errors:
Deprecated: Assigning the return value of new by reference is deprecated in C:\wamp\www\ci\system\codeigniter\Common.php on line 130
Deprecated: Assigning the return value of new by reference is deprecated in C:\wamp\www\ci\system\codeigniter\Common.php on line 136
In index.php in your CI folder replace line 12 “
“
Then, you’ll probably get an error about a bad URI if you try to run any controlls. It should say something like this: “The URI you submitted has disallowed characters.”
Here’s the solution for that as well. In URI.php which is located in \system\libraries replace line 189:
“
to read like this:
“
Deprecated: Assigning the return value of new by reference is deprecated in C:\wamp\www\ci\system\codeigniter\Common.php on line 130
Deprecated: Assigning the return value of new by reference is deprecated in C:\wamp\www\ci\system\codeigniter\Common.php on line 136
In index.php in your CI folder replace line 12 “
error_reporting(E_ALL);” (without quotes) with this:“
error_reporting(E_ALL & ~E_DEPRECATED);” (without quotes)Then, you’ll probably get an error about a bad URI if you try to run any controlls. It should say something like this: “The URI you submitted has disallowed characters.”
Here’s the solution for that as well. In URI.php which is located in \system\libraries replace line 189:
“
if ( ! preg_match("|^[".preg_quote($this->config->item
('permitted_uri_chars'))."]+$|i", $str))” (without quotes and without the line break (it’s all one line)to read like this:
“
if ( ! preg_match("|^[".str_replace('\\-', '-', preg_quote ($this->config->item('permitted_uri_chars')))."]+$|i", $str))” again without the quotes.
Subscribe to:
Posts (Atom)