dependency injection in oops in php part -16(hindi/urdu)



in this video tutorials i will tell you about dependency injection in oops in php hindi/urdu part-16

for sublime text shortcut technic download this file and see instruction:

For best and good quality hosting on hostinger at good price ,please click on this link

, , , , , ,

13 thoughts on “dependency injection in oops in php part -16(hindi/urdu)

  1. Fatal error: Uncaught Error: Call to a member function query() on null in C:xampphtdocsONLINE EXAMclassusers.php:19 Stack trace: #0 C:xampphtdocsONLINE EXAMsignup.php(14): users->signup(' insert into si…') #1 {main} thrown in C:xampphtdocsONLINE EXAMclassusers.php on line 19

    this is my user.php
    <?php
    class users{
    public $host="localhost";
    public $username="root";
    public $pass="";
    public $dbname="college";
    public $conn;
    public function _construct()

    {
    $this-> conn= new mysqli($this->$host,$this->$username,$this->$pass,$this->$dbname);
    if ($this->conn->connect_errno)
    {
    die ("Database connection failed".$this->conn_connect_errno);
    }
    }
    public function signup($data)
    {
    $this->conn->query($data);
    return true;

    }

    }

    ?>
    this is my signup

    <?php
    include ("class/users.php");
    $register= new users;
    extract ($_POST);
    $name=$_POST['name'];
    $father=$_POST['father'];
    $mother=$_POST['mother'];
    $email=$_POST['email'];
    $pwd=$_POST['pwd'];
    $img_name=$_FILES['file']['name'];
    $tmp_name=$_FILES['file']['tmp_name'];
    move_uploaded_file($tmp_name,"img/".$img_name);
    $query=" insert into signup values ('','$name','$father','$mother','$email','$pwd','$img_name')";
    if($register->signup($query))
    {
    $register->url("index.php?run=success");

    }

    ?>

    pls help me how i solve this

Leave a Reply

Your email address will not be published. Required fields are marked *