Results 1 to 4 of 4

Thread: php check entry problem

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Nov 2002
    Location
    Philippines
    Posts
    877

    php check entry problem

    hello, can anyone help me with check entry and insert if not in my database..

    my code is:
    PHP Code:
    if ($Worked) {
        echo 
    "Credit=$Credit";

    if(
    $Credit=="0"){

    //Update account
    $Result mysql_query("UPDATE tblUser SET Credit='0' WHERE Username='$Username'and Password='$Password'") or die ("");

    } else {

    //Check IMEI
    $Result MYSQL_QUERY("SELECT * from tblAsk WHERE sIMEI='$IMEI'") or die ("");

    $Worked mysql_fetch_array($Result);

    $IMEI $Worked[sIMEI];

    if (
    $Worked) {
        echo 
    "SERVER: ASK file is already in queue ...</br>";
        echo 
    "SERVER: DCT4, request queued in 30 sec upto 48 hours.</br>";
        echo 
    "SERVER: Relogin to check your request status, resend ASK to get your RPL.";
    } else {

    $Credit -= 1//Decrease by 1

    //Update account
    $Result mysql_query("UPDATE tblUser SET Credit=$Credit WHERE Username='$Username'and Password='$Password'") or die ("");

    //Insert to tblAsk
    $Result mysql_query("INSERT INTO tblAsk (Username, sIMEI, sCHANGED, sASIC, sDATA) 
    VALUES ('
    $Username', '$IMEI', '$CHANGED', '$ASIC', '$DATA')");

    }

    }

    } else {

        echo 
    "SERVER: Invalid username or password, please check your details and try again !";

    }
    mysql_close($con); 
    when i tried inserting IMEI in my database it insert but BLANK, what im trying to do insert and IMEI into my database and if its already there then do not INSERT.

    what should i do?

    Thanks!

    Regards,

  2. #2
    Frenzied Member
    Join Date
    May 2003
    Location
    So Cal
    Posts
    1,564

    Re: php check entry problem

    You can always do INSERT with ON DUPLICATE UPDATE parameter.

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Nov 2002
    Location
    Philippines
    Posts
    877

    Re: php check entry problem

    Quote Originally Posted by BrianS
    You can always do INSERT with ON DUPLICATE UPDATE parameter.
    what do you mean by duplicate update? you mean i will do UPDATA in my tblAsk instead of INSERT?

  4. #4
    Frenzied Member StrangerInBeijing's Avatar
    Join Date
    Mar 2005
    Location
    Not in Beijing
    Posts
    1,666

    Re: php check entry problem

    see if this help
    Install and Configure Eclipse For both Java and PHP development
    Accessible Ajax/jQuery Forms Degrade gracefully with JavaScript Disabled

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