SHARE
TWEET

Untitled

a guest Jun 16th, 2019 54 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $db = mysqli_connect('localhost', '*******', '********', '***********');
  2.  
  3.  
  4.       $user_check_query = "SELECT partnerCodeOwner1 FROM refer where  randomfield='$partnerCode'";
  5.   $result = mysqli_query($db, $user_check_query);
  6.   $row = mysqli_fetch_array($result, MYSQLI_ASSOC);
  7.  
  8.  
  9.  
  10. // --------------------HERE I'm trying to check for the same value in columns--------
  11. //But incorrect! Syntax error?
  12.  
  13.     if ($row) { // compare columns But incorrect
  14.     if ($row['username'] === ['partnerCodeOwner1']) {
  15.       array_push($errors, "U can't invest to yourself");
  16.     }
  17.  
  18.  
  19.  
  20.  
  21.     if(empty($row['partnerCodeOwner1'])) {
  22.         $query = "update refer
  23.                     set partnerCodeOwner1= '" . $_SESSION['username'] . "'  
  24.                 where randomfield='$partnerCode' ;";
  25.     }else {
  26.         $query = "update refer
  27.                     set partnerCode= '" . $_SESSION['username'] . "'  
  28.                 where randomfield='$partnerCode'  ";        
  29.     }
  30.  
  31.     mysqli_query($db, $query);
  32. }      
  33. ?>
  34.      
  35. ID      randomfield    username      partnerCode    partnerCodeOwner1  
  36. +-------+ ------------+-------------+-----------------+-----------+
  37. |   1   | A45scdv     |  John       |  Not same       |    John   |
  38. +-------+-------------+-------------+-----------------+-----------+
  39. |   2   | das654d     | Alex        |  Alex           | Not same  |
  40. +-------+-------------+-------------+-----------------+-----------+
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top