[Help] mssql_query update value only once

Apfre

Member
Joined
Aug 30, 2016
Messages
87
Reaction score
8
Hello, maybe some can help me with my problem, i want this mysql_query work only once per all time, how to do it correct?

if($final => 10){$example = mssql_query("Update Character Set Money='$rmoney',PkLevel='3',PkTime='0' where name='$character'");}

The problem is table update all time when some refresh the page.
 

Apfre

Member
Joined
Aug 30, 2016
Messages
87
Reaction score
8
<?php
mssql_select_db("MuOnline") or die();

$topq = mssql_query("Select name,resets from character");

$row = mssql_fetch_row($topq);

if($resets >= 30 && $row[0] = Spiritmu)

{$test = mssql_query("Update MEMB_CREDITS set credits = credits+$credits WHERE memb___id='Spiritmu'")
;}


?>
 

ivowe3

Wiki
Joined
Apr 1, 2009
Messages
1,198
Reaction score
1,254
Make new column(used,int) with value 0 and after update update and value to 1 and check that in query.

PHP:
<?php
$charactername = "Spiritmu";
$credits = 500;
$row = mssql_fetch_row(mssql_query("SELECT AccountID, Resets, used FROM Character WHERE Name='$charactername'"));

if($row[1] >= 30 and $row[2]<=0 )
{
mssql_query("UPDATE MEMB_CREDITS SET credits=credits+$credits WHERE memb___id='$row[0]'");
mssql_query("UPDATE Character SET used=1 WHERE Name='$charactername'");
}
?>