keymasterviriya1150

insertdatabsephp

Mar 22nd, 2016
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.45 KB | None | 0 0
  1. <?php
  2.     $con=mysqli_connect("localhost","root","","class");
  3.     if($con!=null)
  4.         echo"Sucess";
  5.    
  6.     $result=mysqli_query($con,'INSERT INTO student VALUES("'.$_POST['text1'].'","'.$_POST['text2'].'","'.$_POST['text3'].'","'.$_POST['text4'].'","'.$_POST['text5'].'","'.$_POST['text6'].'");
  7.  
  8.    
  9.     $result=mysqli_query($con,"SELECT * FROM student");
  10.     if(!$result)
  11.         die("connot");
  12.     else
  13.     {
  14.         echo'<table border="1">';
  15.            echo '<tr>';
  16.                
  17.                echo '<td>';
  18.                    echo "StudentID";
  19.                echo '</td>';
  20.  
  21.                 echo '<td>';
  22.                    echo"Firstname";
  23.                echo '</td>';
  24.                
  25.                echo '<td>';
  26.                       echo "Lastname";
  27.                echo '</td>';
  28.  
  29.                echo '<td>';
  30.                       echo "Address";
  31.                echo '</td>';
  32.  
  33.                echo '<td>';
  34.                       echo "Major";
  35.                echo '</td>';
  36.  
  37.                echo '<td>';
  38.                       echo "TeacherID";
  39.                echo '</td>';
  40.            
  41.            echo '</tr>';
  42.     }
  43.     while($row=mysqli_fetch_array($result,MYSQLI_NUM))
  44.        {
  45.            echo '<tr>';
  46.            for($i=0;$i<=5;$i++)
  47.                echo'<td>'.$row[$i].'</td>';
  48.            echo '</tr>';
  49.          
  50.        }
  51.    echo "</table>";
  52.    $result=mysqli_close($con);
  53.     /*function input()
  54.     {
  55.     echo "<from name=>"
  56.  
  57.  
  58.     } */
  59.  
  60. ?>
Advertisement
Add Comment
Please, Sign In to add comment