0

a_moipおよびa_google_analy他の文字列としてデータベース内の整数です

<?
@$c_google = $_POST['c_google_analystics'];
@$c_moip = $_POST['c_moip'];

$code = $_POST['google_analystic'];
$token = $_POST['moip_token'];
$key = $_POST['moip_key'];

if(isset($c_google) or isset($c_moip)) {

    if(!isset($c_google)) {
        $c_google == 0;
        $code == NULL;
    }
    else {
        $c_google == 1;
    }

    if(!isset($c_moip)) {
        $c_moip == 0;
        $key == NULL;
        $token == NULL;
    }
    else {
        $c_moip == 1;
    }

    $q = new Query;
    $q
            ->update('config')
            ->set(
                    array(
                        'a_google_analy' => $c_google,
                        'a_moip' => $c_moip,
                        'google_analy' => $code,
                        'moip_token' => $token,
                        'moip_key' => $key
                    )
            )
            ->where_equal_to(
                    array(
                        'id' => 1 // bug fix
                    )
            )
            ->run();
}
else {

    $q = new Query;
    $q
            ->update('config')
            ->set(
                    array(
                        'a_google_analy' => 0,
                        'a_moip' => 0,
                        'google_analy' => NULL,
                        'moip_token' => NULL,
                        'moip_key' => NULL
                    )
            )
            ->where_equal_to(
                    array(
                        'id' => 1 // bug fix
                    )
            )
            ->run();
}
?>

配列に印刷を作成しました。変数は処理されていません。「オン」にチェックすると常に表示されます。

4

2 に答える 2

1

==次のような変数に値を割り当てるために二重等号を使用しました

$c_google == 0;
$code == NULL;

単一のものを使用=してください それらすべてを修正してください

于 2013-05-09T08:26:16.223 に答える