0

I have a php code which changes a user's raffle1 column to 1 if his steamid = '$a' and his name like '% royalcodes.com'.

I'm just wondering how I can show a message if it has these what I showed before.

I tried like this. This is the full code at all..

if(!isset($_SESSION['steamid'])) {
    //Nah
} else {
    include ('steamauth/userInfo.php');
    $a=$steamprofile['steamid'];
    $b=$steamprofile['personaname'];
}

if (isset($_POST['raffle1'])) {
    $query = "UPDATE users SET raffle1 = '1' WHERE name LIKE '% royalcodes.com' AND steamid = '$a'";
    $result = mysqli_query($conn, $query);
    $query2 = "SELECT * FROM NOT LIKE '% royalcodes.com'";
    $result22 = mysqli_query($conn, $query2);
    if ($result) {
        $smsg = "Succesfully registered to the raffle. Good luck!";
    } else if($result22) {
        $fmsg = "Put royalcodes.com to enter the raffle!";
    }
}   
if (isset($_SESSION['raffle1'])){
    $username = $_SESSION['raffle1'];
    header("Location: raffle1.php");
} else {
    #Here I have some html code then I have this in a div
    if (isset($smsg)) { ?>
        <div role="alert"> <?php echo $smsg; ?> </div><?php
    }
    if (isset($fmsg)) { 
        ?><div role="alert"> <?php echo $fmsg; ?> </div><?php
    }
    #Closing the file with php syntax
}
mickmackusa
  • 43,625
  • 12
  • 83
  • 136
Red Rubix
  • 11
  • 1
  • Do you need to differentiate between users that 1. have a matching `steamid` but no `name` match? 2. have a matching `steamid` and a matching `name` but `raffle1!=1` and 3. have a matching `steamid` and a matching `name` and already have `raffle1=1`? – mickmackusa Feb 04 '18 at 11:26
  • I don't need to differentiate. Just if someone's steamid = '$a' and name LIKE '% royalcodes.com' writes the '$smsg' and if anyone doesn't match writes the '$fmsg'. – Red Rubix Feb 04 '18 at 11:30

0 Answers0