데이터베이스 관련/PHP | HTML

프로젝트 1 [상세보기/매칭신청/매칭취소/PHP]

CE : 하랑 2022. 6. 29. 15:00

 

 

 

매칭 신청 (다른 아이디 상세보기 화면)

 

 

매칭신청 버튼 클릭

 

 

 

 

매칭취소 버튼 클릭

 

 

 



 

매칭신청 코드

<PHP up.php>

 

<?php
	$id = $_GET['id'];
    $no=$_GET['no'];
    $connect=mysqli_connect("localhost","root","000000");
    mysqli_select_db($connect,"used");
	$sql = "update board set count=1 where id2!='$id' and no='$no'";
    $info=mysqli_query($connect,$sql);
    if($info){
        echo "<script>alert('매칭신청완료')</script>";
        echo "<script>location.replace('togather.php?id=$id');</script>";
      }
      else{
        echo "<script>alert('매칭신청실패')</script>";
        echo "<script>location.replace('togather.php?id=$id');</script>";
        exit;
      }
?>

 


 

매칭취소 코드

<PHP down.php>

 

<?php
	$id = $_GET['id'];
    $no=$_GET['no'];
    $connect=mysqli_connect("localhost","root","000000");
    mysqli_select_db($connect,"used");
	$sql = "update board set count=0 where id2!='$id' and no='$no'";
    $info=mysqli_query($connect,$sql);
    if($info){
        echo "<script>alert('매칭취소성공')</script>";
        echo "<script>location.replace('togather.php?id=$id');</script>";
      }
      else{
        echo "<script>alert('매칭취소실패')</script>";
        echo "<script>location.replace('togather.php?id=$id');</script>";
        exit;
      }
?>