如何检查行是否已更新?

时间:2018-02-04 11:16:48

标签: php mysql sql if-statement select

我有一个PHP代码,如果用户raffle1及其1,则会将用户的steamid = '$a'列更改为name like '% royalcodes.com'

我只是想知道如果它具有我之前展示的内容,我将如何显示消息。

我试过这样的。这是完整的代码..

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
}

0 个答案:

没有答案