Results 1 to 6 of 6

Thread: SQL Value +1

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 2022
    Posts
    70

    SQL Value +1

    can someone tell me how to add the value in
    PHP Code:
    inuse 
    plus one?

    PHP Code:
                if ($lKey->Get('hwid') != '' && $lKey->Get('hwid') != $hwid){
                    
    $result = array("success"=>"false""reason"=>"");
                    echo 
    Encryption::Encrypt(json_encode($result));
                    
    $lKey->Update('inuse', + 1);
                    
    $lKey->Save();
                    die();
                } 

  2. #2
    PowerPoster Zvoni's Avatar
    Join Date
    Sep 2012
    Location
    To the moon and then left
    Posts
    4,418

    Re: SQL Value +1

    I don’t see a SQL-Statement…
    Last edited by Zvoni; Tomorrow at 31:69 PM.
    ----------------------------------------------------------------------------------------

    One System to rule them all, One Code to find them,
    One IDE to bring them all, and to the Framework bind them,
    in the Land of Redmond, where the Windows lie
    ---------------------------------------------------------------------------------
    People call me crazy because i'm jumping out of perfectly fine airplanes.
    ---------------------------------------------------------------------------------
    Code is like a joke: If you have to explain it, it's bad

  3. #3
    Smooth Moperator techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,532

    Re: SQL Value +1

    I "do" ... but it's PHP, not VB so it's another lost thread that's going to get all the wrong responses...

    stand by, asking the mods to move it...


    -tg

    EDIT - while it is a DB question, because of the library and technoloigy being used, it's less appropriate for the DB area, as it doesn't relate to general SQL ... but rather a mis use of a library in a specific language...
    Last edited by techgnome; Nov 8th, 2022 at 10:05 AM.
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  4. #4
    Smooth Moperator techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,532

    Re: SQL Value +1

    Code:
                    $lKey->Update('inuse', + 1);
                    $lKey->Save();
    You're not updating the data there ... you're setting it to 1. You need to get the current value, +1 it, THEN use that result in the update.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Jan 2022
    Posts
    70

    Re: SQL Value +1

    Sorry, I don't know much about PHP and I'm trying my hand at it.

    in the cell "inuse" is 1
    if the stored hwid is wrong at
    PHP Code:
    if ($lKey->Get('hwid') != '' && $lKey->Get('hwid') != $hwid){
                    
    $result = array("success"=>"false""reason"=>"Current Key is locked to different HWID, please contact product owner.");
                    
    $lKey->Get('inuse');
                    
    $lKey->Set('inuse'$inuse);
                    
    $lKey->Save();
                    echo 
    Encryption::Encrypt(json_encode($result));
                    die();
                } 
    the cell "inuse" + 1 should be added, which is then in the cell 2.

    This is all the code:
    PHP Code:
    <?php
    include('config/init.php');
    if (isset(
    $_POST['action'])){

        if (
    $_POST['action'] == 'init'){
            
    Encryption::Init(Config::Get('system.secret_app_key'));
        }
    }
    else {
        
    $request file_get_contents('php://input');
        
    $decrypted Encryption::Decrypt($request);
        
    $json json_decode($decryptedtrue);
        if (isset(
    $json['action']) == false)
        {
            
    $result = array("success"=>"false""reason"=>"No API call specified.");
            echo 
    Encryption::Encrypt(json_encode($result));
            die();
        }
        else {

            
    $action $json['action'];
            if (
    $action == "login") {
                
    $key $json['key'];
                
    $hwid $json['hwid'];
                
    $used '1';
                
    $inuse = + 1;
                
    $app $json['app'];
                
    $lKey = new LicenseKey();
                if (
    $lKey->Load(array('license_key'=>$key)) == false){
                    
    $result = array("success"=>"false""reason"=>"Specified License Key was not found in our database.");
                    echo 
    Encryption::Encrypt(json_encode($result));
                    die();

                if (
    $lKey->Get('hwid') != '' && $lKey->Get('hwid') != $hwid){
                    
    $result = array("success"=>"false""reason"=>"Current Key is locked to different HWID, please contact product owner.");
                    
    $lKey->Get('inuse');
                    
    $lKey->Set('inuse'$inuse);
                    
    $lKey->Save();
                    echo 
    Encryption::Encrypt(json_encode($result));
                    die();
                }
                
    $result = array("success"=>"true""reason"=>"You have been logged in.""expires_on"=>Utils::GetDateNice($lKey->Get('expires_on')));
                echo 
    Encryption::Encrypt(json_encode($result));
                
    Session::Set('key'$key);
                
    Session::Set('app_id'$app);
                
    Session::Set('hwid'$hwid);
                
    $onl = new OnlineUser();
                
    $onl->Update();
                die();
            }

        }
    }
    i think this is wrong
    PHP Code:
                    $lKey->Get('inuse');
                    
    $lKey->Set('inuse'$inuse);
                    
    $lKey->Save(); 

  6. #6

    Thread Starter
    Lively Member
    Join Date
    Jan 2022
    Posts
    70

    Re: SQL Value +1

    no one has an idea?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width