Php Code Example for View Edit Delete Search Update Database Table From Gunjan Kumar

download Php Code Example for View Edit Delete Search Update Database Table From Gunjan Kumar

of 11

description

Example for View Edit Delete Search Update Database Table

Transcript of Php Code Example for View Edit Delete Search Update Database Table From Gunjan Kumar

  • Php Code for View, Search, Edit and Delete Record 2010

    Code Example Page 1

    PPhhpp CCooddee ffoorr VViieeww,, SSeeaarrcchh,, EEddiitt aanndd DDeelleettee RReeccoorrdd ffrroomm MMyySSqqll TTaabbllee

    PHP (recursive acronym for "PHP: Hypertext Preprocessor") is a widely-used Open Source general-

    purpose scripting language that is especially suited for Web development and can be embedded

    into HTML.

    This is the simple Code Example through which you can insert, Delete, View , Update from MySql

    Database.

    Paste this code and save the file as written above. Create a database named test and create a

    table student as below structure.

    CREATE TABLE `student` ( `roll` int(11) default NULL, `class` varchar(20) default NULL, `name`

    varchar(40) default NULL, `f_name` varchar(40) default NULL, `sex` varchar(6) default NULL,

    `addr1` varchar(20) default NULL, `addr2` varchar(20) default NULL, `addr3` varchar(20) default

    NULL, `city` varchar(20) default NULL, `phone` varchar(12) default NULL, `email` varchar(100)

    default NULL, `remarks` varchar(40) default NULL) ENGINE=InnoDB DEFAULT CHARSET=utf8;

    Index.php [Main or Home Page]

    Search Student Record Student Database Search Enter Search Keyword Add Record Delete Record Update Record

  • Php Code for View, Search, Edit and Delete Record 2010

    Code Example Page 2

    Index.php (Snapshot) Student Database

    Search

    Enter Search Keyword

    Search

    Add Record

    Search.php Search Student Record Student Database Search Enter Search Keyword Roll & class Name & Father's Name

  • Php Code for View, Search, Edit and Delete Record 2010

    Code Example Page 3

    $flag=1; echo "",$row[0],", ",$row[1],"",$row[2],", ",$row[3],"Edit | Delete";

    } if($flag==0) echo "Record not found";

    ?> Add Record Search.php(Snapshots)

    Student Database

    Search

    Enter Search Keyword

    Search

    Roll & class Name & Father's Name

    1, 10 Gunjan Kumar, Prem Shankar Edit | Delete

    3, 10 Sonali Verma, Radhe Shyam Edit | Delete

    4, 10 Nikki Kumari, Manohar pd Edit | Delete

    Add Record

    View.php View Student Record Student Database

  • Php Code for View, Search, Edit and Delete Record 2010

    Code Example Page 4

  • Php Code for View, Search, Edit and Delete Record 2010

    Code Example Page 5

    View.php(Snapshots) Student Database

    VIEW STUDENT DATABASE

    Roll Number 1 Class 10

    Name of Student Gunjan Kumar Father's Name Prem Shankar

    Sex Male Address1 Kankarbagh

    Address2 Lohia Nagar Address3

    City Patna Phone 9334457195

    Email [email protected] Remarks No remarks

    Go Back to Home

    Add.php Add Student Record Student Database

  • Php Code for View, Search, Edit and Delete Record 2010

    Code Example Page 6

    $sex=$_POST["sex"]; $addr1=$_POST["addr1"]; $addr2=$_POST["addr2"]; $addr3=$_POST["addr3"]; $city=$_POST["city"]; $phone=$_POST["phone"]; $email=$_POST["email"]; $remarks=$_POST["remarks"]; $query="insert into student value($roll,'$class','$name','$fname','$sex','$addr1','$addr2','$addr3','$city','$phone','$email','$remarks')"; mysql_query($query); echo "Successfully store in DATABASE";

    } ?> ADD STUDENT RECORD Enter Roll Number Enter Class Enter Name of Student Enter Father's Name Sex Male Female Address1 Address2 Address3

  • Php Code for View, Search, Edit and Delete Record 2010

    Code Example Page 7

    City Phone Email Remarks Go Back to Home Add.php(Snapshots)

    Student Database

    ADD STUDENT RECORD

    Enter Roll Number

    Enter Class

    Enter Name of Student

    Enter Father's Name

    Sex Male Female Address1

    Address2

    Address3

    City

    Phone

    Email

    Remarks

    ADD RECORD

    Go Back to Home

    Edit.php

  • Php Code for View, Search, Edit and Delete Record 2010

    Code Example Page 8

    Update Student Record

  • Php Code for View, Search, Edit and Delete Record 2010

    Code Example Page 9

  • Php Code for View, Search, Edit and Delete Record 2010

    Code Example Page 10

    Edit.php(Snapshots) Student Database

    ADD STUDENT RECORD

    Enter Roll Number 3 Enter Class 10

    Enter Name of Student Sonali Verm

    Enter Father's Name Radhe Shya

    Sex Male Female Address1

    Address2

    Address3

    City Patna

    Phone

    Email sonali.chand

    Remarks

    UPDATE RECORD

    Go Back to Home

    Del.php Add Student Record

  • Php Code for View, Search, Edit and Delete Record 2010

    Code Example Page 11

    You can also find this code from http://infozones.in/docs/ex1.rar

    Change the code as per your requirement

    Visit http://infozones.in for Job(India) , Online GS Quiz and Online Reference Notes

    Know About Bihar from Bihar Directory Visit http://bihar.infozones.in

    If you found any error or if you have any feedback regarding this code example mail me at [email protected]