Posts

change password

<?php           if(isset($_POST['change']))           {               include"include/connection.php";             $query='select * from enabler_register where username="'.$_SESSION['username'].'"and password="'.$_POST['pass'].'"';                $res=mysqli_query($con,$query);             if(mysqli_num_rows($res)>0)             {                 if(strlen($_POST['pass1'])>=6)                 {                     if($_POST['pass1']==$_POST['pass2'])       ...

photo upload

<html> <head>  <script src="assets/js/jquery-1.10.2.js"></script>     <!-- BOOTSTRAP SCRIPTS -->     <script src="assets/js/bootstrap.js"></script>     <!-- PAGE LEVEL SCRIPTS -->     <script src="assets/js/bootstrap-fileupload.js"></script>     <!-- METISMENU SCRIPTS -->     <script src="assets/js/jquery.metisMenu.js"></script>     <!-- CUSTOM SCRIPTS -->     <script src="assets/js/custom.js"></script>         </head> <body> <form method="post" enctype="multipart/form-data"> <input  type="file" name="photo"><br> <input type="submit" name="submit" value="SEND"> </form>     <?php         $con=mysqli_connect("localhost","root","root","img") or die(...

view record

<!DOCTYPE html> <html> <head>     <title></title> </head> <body> <?php      $dbname="demo";     $con=mysqli_connect("localhost","root","root","demo") or die(mysqli_error());    $query=mysqli_query($con,"select * from tbl1 ") or die(mysqli_error($con));    ?>    <table border="1">            <tr>                <td>Name</td>                <td>surname</td>            </tr>      <?php      while($row=mysqli_fetch_array($query))      {      extract($row);      ?>      <tr>       ...

Assignment

Image

How to insert data into Database using PHP

 1. Create Form and give name form.php, the file look like :            <form method="post" action="insert.php">              <label>Name</label>              <input type="text" name="name" />                          <label>Surname</label>              <input type="text" name="surname" />             <input type="submit" name="submit" />          </form>  2. create database connection and give name db.php and create table give name tbl1, the file look like :       <?php             $con=mysqli_connect("localhost","root","root","demo") or     die(mysqli_...

How to connect to database using PHP and MySQL

<?php $dbname="your db name"; $server="your server name e.g. localhost"; $username="your username e.g. root"; $password=" your password"; $connect = mysqli_connect($dbname,$server,$username,$password) or die(mysqli_error()); if($connect) {  echo "Database connection successfully.."; }else { echo "error while connecting  to the database"; } ?>