Saturday, February 26, 2011

List files in directory and sub directories

$file){
foreach (ListFiles('.') as $key=>$file)
{
echo $file ."
";
}
?>

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


      

Thursday, June 10, 2010

ADD,UPDATE records in PHP



config.php
========================
$dbHost = “localhost”;
$dbUser = “root”;
$dbPassword = “”;
$dbName= “hanzala”;
$con = mysql_connect($dbHost, $dbUser, $dbPassword);
mysql_select_db($dbName, $con);
session_start();
//  echo “
”; print_r($_SESSION);
 exit;
?>
action.php
======================================================================= 
include “config.php”;
if(isset($_POST['submit']) && 
$_POST['submit'] == ‘Register’)
{
$name = $_POST['name'];
$password = $_POST['password'];
$city = $_POST['city'];
$state = $_POST['state'];
$sex = $_POST['sex'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$insert = “INSERT INTO test02 SET empName =
 ‘$name’, empPass = ‘$password’, empCity = ‘$city’, empState = ‘$state’,
 empSex = ‘$sex’ empEmail = ‘$email’, empPhone = ‘$phone’”;
$result = mysql_query($insert);
if($result)
{
header(“Location:newpage.php?msg = 
Registration Completed”);
exit;
}
}
if(isset($_POST['submit']) && 
$_POST['submit'] == ‘Update’)
{
$name = $_POST['name'];
$password = $_POST['password'];
$city = $_POST['city'];
$state = $_POST['state'];
$sex = $_POST['sex'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$queryupdate = “UPDATE test02 SET empName =
 ‘$name’, empPass = ‘$password’, empCity = ‘$city’, empState = ‘$state’,
 empSex = ‘$sex’, empEmail = ‘$email’, empPhone = ‘$phone’”;
$result = mysql_query($queryupdate);
if($result)
{
header(“Location:newpage.php?msg = Update 
Succefully”);
exit;
}
}
if(isset($_POST['submit']) && 
$_POST['submit'] == ‘Login’)
{
$name = $_POST['name'];
$password = $_POST['password'];
$queryLogin = “SELECT * FROM test02 WHERE 
empName = ‘$name’ AND empPass = ‘$password’ “;
$resultLogin = mysql_query($queryLogin);
if(mysql_num_rows($resultLogin) > 0)
{
$row = mysql_fetch_assoc($resultLogin);
$_SESSION['empId'] = $row['empId'];
$_SESSION['empName'] = $row['empName'];
header(“Location: log_success.php”);
exit;
}
else
{
header(“Location: login.php?msg=Login 
Failed”);
}
}
if(isset($_GET['submit']) && 
$_GET['submit'] == ‘logout’)
{
session_destroy();
header(“Location: login.php”);
}
?>

Saturday, April 10, 2010

Father Of Algebra

ABU JA'FAR Mohammed ibn-Musa al-Khwarizmi was born sometime before 800 A.D. and died after 847 A.D. He flourished as a mathematician and astronomer who was a faculty member at the "House of Wisdom" established in Baghdad by Al-Mamun.

Harun al-Rashid became the fifth Caliph of the Abbasid dynasty on 14 September 786, about the time that al-Khwarizmi was born. Harun ruled, from his court in the capital city of Baghdad, over the Islam empire. He brought culture to his court and tried to establish the intellectual disciplines which at that time were not flourishing in the Arabic world. He had two sons, the eldest was al-Amin while the younger was al-Mamun. Harun died in 809.

Al-Mamun became Caliph and ruled the empire from Baghdad. He continued the patronage of learning started by his father and founded an academy called the House of Wisdom where Greek philosophical and scientific works were translated.

Al-Khwarizmi's work


Al-Khwarizmi and his colleagues the Banu Musa were scholars at the House of Wisdom in Baghdad. Their tasks there involved the translation of Greek scientific manuscripts and they also studied, and wrote on, algebra, geometry and astronomy. Certainly al-Khwarizmi worked under the patronage of Al-Mamun and he dedicated two of his texts to the Caliph. These were his treatise on algebra and his treatise on astronomy. The algebra treatise Hisab al-jabr w'al-muqabala was the most famous and important of all of al-Khwarizmi's works. It is the title of this text that gives us the word "algebra". Here "al-jabr" means "completion" and is the process of removing negative terms from an equation. For example, using one of al-Khwarizmi's own examples, "al-jabr" transforms x2 = 40 x - 4 x2 into 5 x2 = 40 x. The term "al-muqabala" means "balancing" and is the process of reducing positive terms of the same power when they occur on both sides of an equation. For example, two applications of "al-muqabala" reduces 50 + 3 x + x2 = 29 + 10 x to 21 + x2 = 7 x (one application to deal with the numbers and a second to deal with the roots).

****************************************************
Source :- http://members.tripod.com/elegant_elaine/father_of_algebra.htm
****************************************************