Friday, April 8, 2016

Index & Edit


INDEX.php

<!DOCTYPE html >
<html l">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Student Information</title>
<link rel="stylesheet" type="text/css" href="Style/viewtablesearch.css" />
</head>
<body>
<center><h1>Welcome to Student</h1></center>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="addnew" href="Add_Form.php" style="font-face:Khmer OS Battambang; font-size:16px;">ចុចត្រង់នេះដើម្បីបន្ថែម Record ថ្មី</a></font>
<div class="search">
<form method="post" action="searchidandname.php">
    <select name="cbosearch">
    <option>ID</option>
    <option>Name</option>
        <option>Gender</option>
        <option>Address</option>
    </select>
<input type="text" name="txtsearch" placeholder="Type to Search" /><input type="submit" name="cmdsearch" value="Search" />
    </form>
    </div>
<table>
    <tr>
            <th>StuID</th>
            <th>StuName</th>
            <th>Gender</th>
            <th>Date of Birth</th>
            <th>Address</th>
            <th>Subject</th>
            <th>Registered Date</th>
            <th>Option</th>
    </tr>
        <?php
include "connect.php";
$i = "select * from tbl_student";
$h = mysql_query($i);
while($tr=mysql_fetch_array($h))
{

?>
        <tr>
        <td><?php echo $tr[0]; ?></td>
            <td><?php echo $tr[1]; ?></td>
            <td><?php echo $tr[2]; ?></td>
            <td><?php echo $tr[3]; ?></td>
            <td><?php echo $tr[4]; ?></td>
            <td><?php echo $tr[5]; ?></td>
            <td><?php echo $tr[6]; ?></td>
            <td align="center"><a href="Delete_Form.php? txtid=<?php echo $tr[0];?>">Delete</a> / <a href="Edit_Form.php? txtid=<?php echo $tr[0];?>">Edit</a> </td>  
        </tr>
        <?php
}
?>

    </table>
</body>
</html>



ADD.php

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Add Form</title>
<link href="Style/Add_Form.css" rel="stylesheet" type="text/css" />
</head>

<body bgcolor="#99CC66" background="Images/MyBackground.png">
<div class="img"><img src="Images/auditoria.png" /></div>
<div class="ii"><center><img src="Images/Edit_Yes.png" style="margin-top:20px"/></center></div>
<div id="topbar">
    <center><h1 style="color:#939">Welcome to Add Form</h1>
    </div>
<div id="form">
<table>
        <form method="post" action="">
            <tr>
             
                <?php
include ("connect.php");
$g = mysql_query("select max(stuid) from tbl_student");
while($id=mysql_fetch_array($g))
{
?>
             
                <th>ID:</th>
                    <td><input type="text" name="txtid" value="<?php echo $id[0]+1; ?>" readonly="readonly" /></td>
                </tr>
                <?php
}
?>
                <tr>
                <th>Name:</th>
                    <td><input type="text" name="txtname" placeholder="Type Name"  /></td>
                </tr>
                <tr>
                <th>Gender:</th>
                    <td><select name="txtgender">
                    <option>Select Gender</option>
                        <option>Male</option>
                            <option>Felmale</option>
                       </select>
                    </td>
                </tr>
                <tr>
                <th>Date of Birth:</th>
                    <td>
                    <select name="txtday">
                        <option>Day</option>
                            <?php
                            //Do Loop while
$d=0;
do{
$d++;
echo "<option>".$d."</option>";
}while($d<=30);
?>
                        </select>
                        <select name="txtmonth">
                        <option>Month</option>
                            <?php
//For Loop
$m=array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
for($i=0;$i<count($m);$i++){
echo"<option>".$m[$i]."</option>";
}
?>

                        </select>
                        <select name="txtyear">
                        <option>Year</option>
                            <?php
                            //While Loop
$y=2021;
while($y>=1950){
$y--;
echo "<option>".$y."</option>";
}
?>
                        </select>
                    </td>
                </tr>
                <tr>
                <th>Address:</th>
                    <td><textarea cols="19px" rows="3" name="txtaddress" placeholder="Type Your Address"  /></textarea></td>
                </tr>
                <tr>
                    <th>Subject:</th>
                    <td>
                    <select name="txtsubject">
                        <option>Select Subject</option>
                            <?php
                            $s=array("Java Script","VB.NET","Graphic Design","PHP & MySQL","C#","C","C++","VBA","HTML and CSS");
for($i=0;$i<count($s);$i++)
{
echo "<option>".$s[$i]."</option>";
}
                            ?>
                        </select>
                    </td>
        </tr>
                <tr>
                <th>Register Date:</th>
                    <td><input type="text" name="txtdate" value="<?php echo date("d/M/Y"); ?>" readonly="readonly" /></td>
                </tr>
                <tr>
                    <td><input type="submit" name="cmdadd" value="Add" /></td>
                    <td><input type="reset" name="cmdreset" value="Clear"/></td>
                </tr>
        </form>
        </table>
    </div>
        <?php
        $id = $_POST['txtid'];
        $name = trim($_POST['txtname']);
        $gender = trim($_POST['txtgender']);
        $dob = trim($_POST['txtday']."/".$_POST['txtmonth']."/".$_POST['txtyear']);
        $address = trim($_POST['txtaddress']);
        $sub = trim($_POST['txtsubject']);
        $date = trim($_POST['txtdate']);
        if(isset($_POST['cmdadd'])){
        if(empty($name) || $gender=="Select Gender" || $_POST['txtday']=="Day" || $_POST['txtmonth']=="Month" || $_POST['txtyear']=="Year" || empty($address) || $subject=="Select Subject")
        {
            echo "<center>Sorry please input data</center>";
        }else{
        include "connect.php";
        $i = mysql_query("insert into tbl_student values('".$id."','".$name."','".$gender."','".$dob."','".$address."','".$sub."','".$date."')");
        if($i==true){
        echo '';
        }
        if($i==true){
        header('Location:index.php');
        exit;
        mysql_close();
        }
        }
    }
    ?>
</body>
</html>


EDIT.php


<!DOCTYPE html >
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Edit Form</title>

<link rel="stylesheet" type="text/css"  href="Style/Edit_Form.css" />

</head>

<body background="Images/MyBackground.png" bgcolor="#FFCC99">
<div class="topbar"> <h1 style="color:#FFF"><center>Edit Form</center></h1></div>    
<center>
    <div class="box">
    <?php
$id = $_GET['txtid'];
include ("connect.php");
$i ="select * from tbl_student where stuid=".$id;
$h= mysql_query($i);
if($tr=mysql_fetch_array($h))
{
?>
    <table><form method="post" action="">
    <tr>
        <th>ID:</th>
        <td><input type="text" name="txtid" value="<?php echo $tr[0]; ?>"/></td>
        </tr>
        <tr>
        <th>Name:</th>
        <td><input type="text" name="txtname" value="<?php echo $tr[1]; ?>" /></td>
        </tr>
        <tr>
        <th>Gender:</th>
        <td>
            <input type="text" name="txtgender" value="<?php echo $tr[2]; ?>" /></td>
            </td>
        </tr>
        <tr>
        <th>Date of Birth:</th>
        <td><input type="text" name="txtdob" value="<?php echo $tr[3]; ?>" /></td>
        </tr>
        <tr>
        <th>Address:</th>
        <td><textarea cols="16" rows="3" name="txtaddress"> <?php echo $tr[4];?> </textarea></td>
        </tr>
        <tr>
        <th>Subject:</th>
        <td><input type="text" name="txtsubject" value="<?php echo $tr[5]; ?>" /></td>
        </tr>            
        <tr>
        <th>Edited Date:</th>
            <td><input type="text" name="txtdate" value="<?php echo $tr[6];?>"/></td>
        </tr>
            <?php
}
?>
        <td colspan="2" align="center"><input type="submit" name="cmdedit" value="Save" />
            <a href="index.php"><img src="Images/Users_Group.png" title="Go Back"/></a>
            </td>
        </tr>
</form></table>
    </div>
    </center>
    <?php
        include ("connect.php");
        $i = mysql_query("update tbl_student set name='".$_POST['txtname']."', gender='".$_POST['txtgender']."', dob='".$_POST['txtdob']."', address='".trim($_POST['txtaddress'])."', sub='".$_POST['txtsubject']."', date='".$_POST['txtdate']."' where stuid=".$_POST['txtid']);
        if($i==true){
        echo '<META HTTP-EQUIV="Refresh" Content="0; URL=index.php">';
        }
        //header('Location::index.php');
        //exit;
        //mysql_close();
    ?>
</body>

</html>



Monday, March 28, 2016

transaction

transaction

A TRANSACTION IS AN EVENT OR HAPPENING THAT CHANGES AN ORGANISATION "S FINANCIAL POSITION AND/OR ITS EARNING.

Sunday, March 6, 2016

form to insert data in database

<html>
  
   <head>
      <title>Add New Record in MySQL Database</title>
   </head>
  
   <body>
      <?php
         if(isset($_POST['add'])) {
            $dbhost = 'localhost';
            $dbuser = 'prakash';
            $dbpass = '123';
            $conn = mysql_connect($dbhost, $dbuser, $dbpass);
           
            if(! $conn ) {
               die('Could not connect: ' . mysql_error());
            }
           
            if(! get_magic_quotes_gpc() ) {
               $emp_name = addslashes ($_POST['emp_name']);
               $emp_address = addslashes ($_POST['emp_address']);
            }else {
               $emp_name = $_POST['emp_name'];
               $emp_address = $_POST['emp_address'];
            }
           
            $emp_salary = $_POST['emp_salary'];
           
            $sql = "INSERT INTO employee ". "(emp_name,emp_address, emp_salary,
               join_date) ". "VALUES('$emp_name','$emp_address',$emp_salary, NOW())";
              
            mysql_select_db('test_db');
            $retval = mysql_query( $sql, $conn );
           
            if(! $retval ) {
               die('Could not enter data: ' . mysql_error());
            }
           
            echo "Entered data successfully\n";
            
            mysql_close($conn);
         }else {
            ?>
           
               <form method = "post" action = "<?php $_PHP_SELF ?>">
                  <table width = "400" border = "0" cellspacing = "1"
                     cellpadding = "2">
                 
                     <tr>
                        <td width = "100">Employee Name</td>
                        <td><input name = "emp_name" type = "text"
                           id = "emp_name"></td>
                     </tr>
                 
                     <tr>
                        <td width = "100">Employee Address</td>
                        <td><input name = "emp_address" type = "text"
                           id = "emp_address"></td>
                     </tr>
                 
                     <tr>
                        <td width = "100">Employee Salary</td>
                        <td><input name = "emp_salary" type = "text"
                           id = "emp_salary"></td>
                     </tr>
                 
                     <tr>
                        <td width = "100"> </td>
                        <td> </td>
                     </tr>
                 
                     <tr>
                        <td width = "100"> </td>
                        <td>
                           <input name = "add" type = "submit" id = "add"
                              value = "Add Employee">
                        </td>
                     </tr>
                 
                  </table>
               </form>
           
            <?php
         }
      ?>
  
   </body>
</html>

 <html>
  
   <head>
      <title>Add New Record in MySQL Database</title>
   </head>
  
   <body>
      <?php
         if(isset($_POST['add'])) {
            $dbhost = 'localhost:3036';
            $dbuser = 'root';
            $dbpass = 'rootpassword';
            $conn = mysql_connect($dbhost, $dbuser, $dbpass);
           
            if(! $conn ) {
               die('Could not connect: ' . mysql_error());
            }
           
            if(! get_magic_quotes_gpc() ) {
               $emp_name = addslashes ($_POST['emp_name']);
               $emp_address = addslashes ($_POST['emp_address']);
            }else {
               $emp_name = $_POST['emp_name'];
               $emp_address = $_POST['emp_address'];
            }
           
            $emp_salary = $_POST['emp_salary'];
           
            $sql = "INSERT INTO employee ". "(emp_name,emp_address, emp_salary,
               join_date) ". "VALUES('$emp_name','$emp_address',$emp_salary, NOW())";
              
            mysql_select_db('test_db');
            $retval = mysql_query( $sql, $conn );
           
            if(! $retval ) {
               die('Could not enter data: ' . mysql_error());
            }
           
            echo "Entered data successfully\n";
            
            mysql_close($conn);
         }else {
            ?>
           
               <form method = "post" action = "<?php $_PHP_SELF ?>">
                  <table width = "400" border = "0" cellspacing = "1"
                     cellpadding = "2">
                 
                     <tr>
                        <td width = "100">Employee Name</td>
                        <td><input name = "emp_name" type = "text"
                           id = "emp_name"></td>
                     </tr>
                 
                     <tr>
                        <td width = "100">Employee Address</td>
                        <td><input name = "emp_address" type = "text"
                           id = "emp_address"></td>
                     </tr>
                 
                     <tr>
                        <td width = "100">Employee Salary</td>
                        <td><input name = "emp_salary" type = "text"
                           id = "emp_salary"></td>
                     </tr>
                 
                     <tr>
                        <td width = "100"> </td>
                        <td> </td>
                     </tr>
                 
                     <tr>
                        <td width = "100"> </td>
                        <td>
                           <input name = "add" type = "submit" id = "add"
                              value = "Add Employee">
                        </td>
                     </tr>
                 
                  </table>
               </form>
           
            <?php
         }
      ?>
  
   </body>
</html>

java

 java
  • Can we overload main method ?
  • Constructor returns a value but, what ?
  • Can we create a program without main method ?
  • What are the 6 ways to use this keyword ?
  • Why multiple inheritance is not supported in java ?
  • Why use aggregation ?
  • Can we override the static method ?
  • What is covariant return type ?
  • What are the three usage of super keyword?
  • Why use instance initializer block?
  • What is the usage of blank final variable ?
  • What is marker or tagged interface ?
  • What is runtime polymorphism or dynamic method dispatch ?
  • What is the difference between static and dynamic binding ?
  • How downcasting is possible in java ?
  • What is the purpose of private constructor?
  • What is object cloning ?

Friday, March 4, 2016

JAVA PROGRAM(ALPHABET PATTERN)

 JAVA  PROGRAM(ALPHABET PATTERN)
A
AB
ABC
ABCD


 /*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package javaapplication23;

/**
 *
 * @author Prakash
 */

public class JavaApplication23 {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
     
  for(int i=1;i<5;i++)
        {
            int a=65;                          //ASCII value of A
            for(int j=1;j<=i;j++)
              {
                System.out.print((char)a);
                a++;
              }
          System.out.println();
        }
    }   
}

2.   A
    ABA
   ABCBA
  ABCDCBA
 ABCDEDCBA
ABCDEFEDCBA
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package javaapplication23;

/**
 *
 * @author Prakash
 */
//enum week{
 //   sun,mon,tue,wed,thurs,fri,sat
//};
import java.util.*;  // import java util 
public class JavaApplication23 {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
       
  Scanner scr=new Scanner(System.in); // create scanner obj
int n;
System.out.println("Enter the number of rows. ");
n=scr.nextInt();  // accept a number


char c;
for(int i=1;i<=n;++i)        // FOR LOOP FOR NUMBER OF ROWS
{
c='A';
for(int j=i;j<n;++j)        // FOR LOOP FOR PRINTING SPACES
{
System.out.print(" ");
}
for(int k=1;k<=i;++k)      // FOR LOOP FOR PRINTING ALPHABETS IN DESCENDING ORDER  
{
System.out.print(c);
++c;
}
c-=2;
for(int l=1;l<i;++l)      // FOR LOOP FOR PRINTING ALPHABETS IN ASCENDING ORDER
{
System.out.print(c);
--c;
}
System.out.println();    // INTRODUCING NEW LINE

}

    }   

}


output
Enter the number of rows. 
6
     A
    ABA
   ABCBA
  ABCDCBA
 ABCDEDCBA
ABCDEFEDCBA



      A
    BAB
   CBABC
  DCBABCD
 EDCBABCDE
FEDCBABCDEF


/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package javaapplication23;

/**
 *
 * @author Prakash
 */
//enum week{
 //   sun,mon,tue,wed,thurs,fri,sat
//};
import java.util.*;  // import java util 
public class JavaApplication23 {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
       
  Scanner scr=new Scanner(System.in);
int n;
System.out.println("Enter the number of rows. ");
n=scr.nextInt();

char ch='A';
char c;
for(int i=1;i<=n;++i)        // FOR LOOP FOR NUMBER OF ROWS
{
c=ch;
for(int j=i;j<n;++j)        // FOR LOOP FOR PRINTING SPACES
{
System.out.print(" ");
}
for(int k=1;k<=i;++k)      // FOR LOOP FOR PRINTING ALPHABETS IN DESCENDING ORDER  
{
System.out.print(c);
--c;
}
c+=2;
for(int l=1;l<i;++l)      // FOR LOOP FOR PRINTING ALPHABETS IN ASCENDING ORDER
{
System.out.print(c);
++c;
}
System.out.println();    // INTRODUCING NEW LINE
++ch;                   //  INCREMENTING VALUE OF CH FOR NEXT ITERATION
}

} // end of main method
} // end of main class

/* OUTPUT

    }   
}


run:
Enter the number of rows. 
6
     A
    BAB
   CBABC
  DCBABCD
 EDCBABCDE
FEDCBABCDEF
BUILD SUCCESSFUL (total time: 4 seconds)


Tuesday, March 1, 2016

ANDROID

DOWNLOAD FILE AND USE APP

ANDROID FIRST APP

CREATE A ANDROID APP
ACCEPT NAME  AND PRINT HII + NAME

FRIST OPEN eclipse
 FILE TAB
OPEN NEW PROJECT AND SELECT ANDROID APPLICATION  PROJECT
THEN APPLICATION NAME
THEN NEXT
THEN NEXT ---------> You CHANGE ICON THEN BROWSERS IMAGE
THEN NEXT -----> AND FINISH
THEN OPEN
FOLDER RES --->
THEN OPEN LAYOUT FOLDER 
AND OPEN activty_main.xaml
and


and open values folder and select string.xaml file and 
code
<?xml version="1.0" encoding="utf-8"?>
<resources>

    <string name="app_name">greation</string>
    <string name="hello_world">Hello world!</string>
    <string name="menu_settings">Settings</string>
 <string name="accept">plz enter name</string>
<string name="show">show</string>
<string  name="a"> hello i am niit student</string>

</resources>

AND activity_main in code 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity" >

    <Button
        android:id="@+id/button1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:layout_marginLeft="98dp"
        android:layout_marginTop="112dp"
        android:onClick="showresult"
        android:text="@string/show" />

    <EditText
        android:id="@+id/accept"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/button1"
        android:layout_alignParentTop="true"
        android:layout_marginTop="26dp"
        android:ems="10" />

    <EditText
        android:id="@+id/result"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/button1"
        android:layout_centerVertical="true"
        android:ems="10" >

        <requestFocus />
    </EditText>

</RelativeLayout>



AND open src folder  and open Mainactivity.java


and code

package com.example.greation;

import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;

public class MainActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.activity_main, menu);
        return true;
    }
    public void showresult(View v)
    {
    EditText et = (EditText)findViewById(R.id.accept);
    String s = et.getText().toString();
    TextView obj = (TextView)findViewById(R.id.result);
    obj.setText("hello"+s);
   
    }
    

}

plz Download FOLDER
download app

ANDROID

Hii friend,
.                I'm start  Android  Tutorial Today . ANY Query in ANDROID PLZ CONTACT ME .

Tuesday, February 23, 2016

PROGRAM

PROGRAM

1.       Wap that print that out the even number 2,4,…..20, using for loop.
2.       Write a program to read in a square, two-d array and display its transpose.
3.       Write a program to accept 10 number I an array. Now print the elements of array. Sort the array and print the ADC & DSc sorted order without using method.
4.        Write a program accept to concatenate two strings without using library function.
5.       Write a program to reverse a string without function.
6.       Write a program count the number of vowel in string.
7.       Write a program to find the length of a string without using library function.
8.       Write a program which replace all vowels in string with character ‘n’.
9.       Write a program takes a number as input and print the sum of all the digits as output.
10.   Write a program takes a number as input & check it is prime number & not. Print the result.
11.   Write a program takes a number as input & print the factorial of the number as output.
12.   Write a program which takes a sentence as input and count the number of space in rhe sentence. Print the result.
13.   Write a program which accept two numbers as input. Find the HCF of two number.
14.   Write a program which takes a sentence as input and then count for the total number of word in the sentence.
15.   Write a program which takes two matrices as input & then add the two matrices. Then print the find resultant matrix.
16.   Write a program in ‘c’ using while loop to find factorial of a positive integer.
17.   Write a program for the no of vowel & consonants in a line of text entered from console.
18.   Write a program to accept any 3 digit integer number 7 display the word equivalent representation of given number.
19.   Write a program to calculate the electricity bill using if-elseif---
    Given the number of units consumed, unit charges are as followers:
·         For frist 50 units         rs 0.50/ units
·         For next 100 units      rs 0.75/ units
·         For next 100 units      rs 1.20 units
·         For next above 250     rs 1.50/units
  20. Star pattern
    *
   ***           
  *****
 *******

*********