Jump to content
Sign in to follow this  
inadatequate

php invite check user

Recommended Posts

Kāds var vēl palīdzēt ar usercheck?

 

if (isset($_POST["submit3"]))
{
  $addusername = $_POST['addusername'];
  $captain = $_POST['captain'];
  $sqlp = "SELECT * FROM `users` WHERE `username` = '$addusername'";
  $resultu = mysqli_query($con, $sqlp);
  while ($row = mysqli_fetch_array($resultu))
  {
    $identi = $row['id'];
    $isql = "SELECT `user_id` FROM `user_invites` WHERE `user_id`='$identi' and `team_id`='$ide' LIMIT 1";
    $iquery = mysqli_query($con, $isql);
    $check_username = mysqli_query($con, "SELECT username FROM users WHERE username = '$addusername' ");
    if (mysqli_num_rows($check_username) == 0)
      {
        $error = '<div class="alert alert-danger" style="margin-top:10px;" role="alert">
                                                  <i class="fa fa-check" aria-hidden="true"></i> Tāds lietotājs neeksistē!
                                                </div>';
      }
    
    if (mysqli_num_rows($iquery) == 0)
    {
      $sqa5 = "INSERT INTO `user_invites`(`team_id`, `user_id`, `captain`) VALUES ('$ide','$identi','$captain')";
      if (mysqli_query($con, $sqa5) == TRUE)
      {
        $error = '<div class="alert alert-success" style="margin-top:10px;" role="alert">
                                                  <i class="fa fa-check" aria-hidden="true"></i> Uzaicinājums tika nosūtīts!
                                                </div>';
      }
      else
      {
        $error = '<div class="alert alert-danger" style="margin-top:10px;" role="alert">
                                                  <i class="fa fa-check" aria-hidden="true"></i> Oops, kaut kas neizdevās!
                                                </div>';
      }
    }
    else
    {
      $error = '<div class="alert alert-danger" style="margin-top:10px;" role="alert">
                                                <i class="fa fa-check" aria-hidden="true"></i> Lietotājam jau ir aktīvs komandas pieprasījums!
                                              </div>';
    }
  }}

 

Atradu pats. Beigās ejot cauri sapratu ka esmu to user check ielicis arraya. Izņemot arā un ieliekot pirms, viss strādā

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.