dimanche 4 février 2018

How to check if a column in database has a value?

I have a php code what's 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

    <?php if(isset($smsg)){ ?><div role="alert"> <?php echo $smsg; ?> </div><?php } ?>
    <?php if(isset($fmsg)){ ?><div role="alert"> <?php echo $fmsg; ?> </div><?php } ?>

Closing the file with php syntax

 <?php } ?>

Aucun commentaire:

Enregistrer un commentaire