Monday, January 24, 2011

Difference Between GET and POST methods

S. NO GET POST
 1 Data is appended to the URL. Data is appended to the URL. 
2 Data is not secret. 

Data is Secret 

3 It is a single call system 

It is a two call system. 

4 Maximum data that can be sent is 256. 

There is no Limit on the amount of data.That is characters any amount of data can be sent. 

5 Data transmission is faster 

Data transmission is comparatively slow. 

6 This is the default method for many browsers 

No default and should be Explicitly specified.

OS Commerce

osCommerce is a popular Open Source online shop e-commerce solution that is powered by a dedicated, strong, and ever growing community, and is released under the GNU General Public License.
Everything you need to get started in selling physical and digital goods over the internet, from the Catalog frontend that is presented to your customers, to the Administration Tool backend that completely handles your products, customers, orders, and online store data.


Source 


http://www.oscommerce.com/

Thursday, January 20, 2011

require() and require_once():

require() includes and evaluates a specific file, while require_once() does that only if it has not been included before (on the same page).
So, require_once() is recommended to use when you want to include a file where you have a lot of functions for example. This way you make sure you don't include the file more times and you will not get the "function re-declared" error.

Difference between require() and include() is that require() produces a FATAL ERROR if the file you want to include is not found, while include() only produces a WARNING.

There is also include_once() which is the same as include(), but the difference between them is the same as the difference between require() and require_once().

require() and include()

require() and include() are identical in every way except how they handle failure.
include() produces a Warning while require() results in a Fatal Error.
In other words, don’t hesitate to use require() if you want a missing file to
 halt processing of the page. include() does not behave this way,
the script will continue regardless. Be sure to have an appropriate
include_path setting as well.

* require() : If the file does not exist, you will get a fatal error.
* include() : If the file does not exist, you will get a warning and the next line of code will execute.


Second Highest Salary

select min(sal) from emp where sal=(select sal from emp where sal<>MIN(SAL) )          
OR
from emp where sal=(select sal from emp having sal<>MIN(SAL)

select min(sal) from emp where sal>(select max(sal) from emp );

SELECT * FROM ( SELECT rownum n id salary FROM (select id salary from employees order by salary )) where n = 2 select min(sal) from emp where sal=(select sal from emp having sal<>MIN(SAL) )

SELECT min(sal) FROM emp WHERE sal > (SELECT Min(sal) FROM emp)

Friday, January 14, 2011

How To insert image into Database.

Please follow the below Steps:-

(1) Create a database

   CREATE TABLE IF NOT EXISTS `image_upload` (
  `image_upload_id` int(11) NOT NULL AUTO_INCREMENT,
  `user_name` varchar(222) NOT NULL,
  `image` varchar(222) NOT NULL,
  PRIMARY KEY (`image_upload_id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;
(2) create a folder structure inside your web application folder.

     images/company

(3) Create a file upload_image.php

     (a) create HTML form using two field name as user_name,image

    (b) inside the form tag use attribute enctype="multipart/form-data".

    (c) and finally use the following code for inserting values.

      
          $connection = mysql_connect("localhost","root","");
         mysql_select_db("hanzala_test",$connection);
      ?>



if(!empty($_POST))
{
   $user_name = $_POST['user_name'];

   if(isset($_FILES['image']['name']) && $_FILES['image']['name']!='')
   {
$desired_path = 'images/company/';

$rand=rand(0,999);
$desired_file_name = $rand.'_'.str_replace(' ','_',strtolower($_FILES['image']['name']));

move_uploaded_file($_FILES['image']['tmp_name'], $desired_path . $desired_file_name);
}

$query_insert = "INSERT INTO image_upload SET
user_name = '".$user_name."',
image = '".$desired_file_name."'

";
mysql_query($query_insert);

header("location:upload_image.php");exit;
}

?>


For Further Assistance Please Contact to me