Boş bir alan kayıtlarına 0 girme?

0 Cevap

İşte benim kod:

if (isset($_POST['addmonths'])){
    if (!empty($_POST['months'])){
        if (is_numeric($_POST['months'])){
            $monthstoadd = $_POST['months'];
            if ($monthstoadd < 1){
                mysql_query("UPDATE users SET months='lifetime' WHERE username='$lookupuser'");
                echo "Successfully set " . $lookupuser . " to lifetime";
            }elseif ($monthstoadd > 0){
                $monthstoadd = $monthstoadd*2592000;
                mysql_query("UPDATE users SET months=months+'$monthstoadd' WHERE username='$lookupuser'");
                echo "Successfully added " . $_POST['months'] . " months to " . $lookupuser . "'s paid time.";
            }else{
                echo "Error.";
            }
        }else{
            echo "Months need to be numeric. If you're trying to set lifetime, use 0.";
        }
    }else{
        echo "You didn't enter anything.";
    }
}

Ben 0 girdiğinizde, ömür boyu için kullanıcı ayarlamak, ama bu nasıl düzeltebilirim bunun yerine sadece yankılanırken You didn't enter anything. Gerçekten emin değilim. Gerekir Herhangi bir fikir?

0 Cevap