|
-
Sep 4th, 2008, 09:08 AM
#1
Thread Starter
Fanatic Member
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,
-
Sep 4th, 2008, 09:41 AM
#2
Frenzied Member
Re: php check entry problem
You can always do INSERT with ON DUPLICATE UPDATE parameter.
-
Sep 4th, 2008, 08:03 PM
#3
Thread Starter
Fanatic Member
Re: php check entry problem
 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?
-
Sep 5th, 2008, 12:26 AM
#4
Frenzied Member
Re: php check entry problem
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|