Welcome to www.HAS.lv - programmējam HTML.

Register now to gain access to all of our features. Once registered and logged in, you will be able to contribute to this site by submitting your own content or replying to existing content. You'll be able to customize your profile, receive reputation points as a reward for submitting content, while also communicating with other members via your own private inbox, plus much more! This message will be removed once you have signed in.

Sign in to follow this  
Followers 0
inadatequate

php invite check user

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ā

0

Share this post


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