Posts

Showing posts from April, 2019

Php Short Course Crud

Login Page with Session  <?php include '../dbconn.php'; session_start(); if(isset($_POST['submit'])) {  $name =$_POST['uname']; $pass =$_POST['pass']; $query = mysqli_query($conn,"select * from user where name='$name' And password='$pass' "); $row =mysqli_fetch_array($query); if(mysqli_num_rows($query)>0) { $_SESSION['user'] = $row['id']; echo $_SESSION['user']; header("location:input.php"); } } ?> <html> <head> <title></title></head> <body> <form method="post" action=""> Username<input type="text" name="uname"><br> Password<input type="password" name="pass"><br> <input type="submit" name="submit" value="submit"><br> </form> ...

Complete Php

Db.php  <?php $host = "localhost"; $user = "root"; $pass = ""; $db   = "practice"; $link =mysqli_connect($host,$user,$pass,$db) or die(mysqli_error()); if($link) { echo "Database Connected Successfully"; } else { echo "Not Connected with a database"; } ?> insert.php <?php include 'db.php'; $phone = $_POST['phone']; $sql =mysqli_query($link,"insert into user (phone) values ('$phone')  "); ?> <hr> Welcome to insert page <br> <a href="logout.php">Logout</a><a href="show.php">show php</a> <form method="post" action=""> Phone<input type="text" name="phone" > <input type="submit"> </form> Show.php with Edit starts here <?php include 'db.php'; $sql = ("select * from user "); $re...