Demo entry 6483341

This is a code


Submitted by anonymous on May 29, 2017 at 12:42
Language: HTML. Code size: 4.3 kB.

<!DOCTYPE html>
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.
        <meta charset="UTF-8">
        <title>This is a site title</title>
        <link href="css/style.css" rel="stylesheet" type="text/css">
        <link href="css/prism.css" rel="stylesheet" type="text/css">
        <script type="text/javascript" src="js/shCore.js"></script>
        <script type="text/javascript" src="css/shBrushJScript.js"></script>
        <link href="css/shCore.css" rel="stylesheet" type="text/css" />
        <link href="css/shThemeDefault.css" rel="stylesheet" type="text/css" />

        <div class="wrapper">
            <div class="header">
                        <li><a href="#">Home</a></li>
                        <li><a href="#">Tutorial</a></li>
                        <li><a href="#">Project</a></li>
            <div class="sidebar">

            <div class="content">
                <div class="maincontent">

                    <pre><code class="language-php">

                        include 'Main.php';
                        class Student extends Main {

                            protected $table = 'tbl_student';
                            private $name;
                            private $dep;
                            private $age;
                            private $data = ''; //for validation purpose

                            function setName($name) { // this function will set the name into private variable name
                                $this->name = $this->validation($name);

                            function setDep($dep) { // this function will set the name into private variable dep
                                $this->dep = $this->validation($dep);

                            function setAge($age) { // this function will set the name into private variable age
                                $this->age = $this->validation($age);

                            public function validation($data) { // this function is for validation data coming from input
                                $this->data = trim($data);
                                $this->data = stripcslashes($this->data);
                                $this->data = htmlspecialchars($this->data);
                                return $this->data;

                            public function insert() { /* this function is for inserting data to table */
                                $sql = "insert into $this->table(name,dep,age) values(:name,:dep,:age)";
                                $stmt = DB::prepare($sql);
                                $stmt->bindParam(':name', $this->name);
                                $stmt->bindParam(':dep', $this->dep);
                                $stmt->bindParam(':age', $this->age);
                                return $stmt->execute();

                            public function update($id) {
                                $sql = "update $this->table set name = :name,dep = :dep,age = :age where id = :id";
                                $stmt = DB::prepare($sql);
                                $stmt->bindParam(':name', $this->name);
                                $stmt->bindParam(':dep', $this->dep);
                                $stmt->bindParam(':age', $this->age);
                                $stmt->bindParam(':id', $id);
                                return $stmt->execute();


            <div class="footer">


        <script src="js/prism.js"></script>   

This snippet took 0.01 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).