Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if($_SERVER["REQUEST_METHOD"]=="POST"){
- $id=$_POST["stdid"];
- $id=trim($id);
- $id=stripcslashes($id);
- $id=htmlspecialchars($id);!
- $host='localhost';
- $user='root';
- $pass=null;
- $db='libman';
- $con=mysqli_connect($host,$user,$pass,$db)or die ("unable to connect");
- $query="select * from management where id='$id'";
- $check=duplicate($query);
- if($check!=0){
- $sqlinsert="insert into management(id) values ('$id')";
- mysqli_query($con,$sqlinsert);
- }else{
- $del="delete from management where id='$id'";
- mysqli_query($con,$del);
- }
- $sqlsearch="select * from management";
- $checker=mysqli_query($con,$sqlsearch);
- $rowcount=mysqli_num_rows($checker);
- $seat=200-$rowcount;
- echo $seat;
- echo "<br>";
- while($show=mysqli_fetch_array($checker)){
- echo $show["id"];
- echo "<br>";
- }
- }
- function duplicate($query){
- global $con,$flag;
- if(mysqli_query($con,$query)){
- $res=mysqli_query($con,$query);
- return $res;
- }
- if(empty(mysqli_query($con,$query))){
- $res=mysqli_query($con,$query);
- return $res;
- }
- }
- ?>
Add Comment
Please, Sign In to add comment