Jump to content

Recommended Posts

Problem....

I have this script which is to run regardless of who's logged in as its meant to update fields.

The problem i am facing is... users can be a paying member, and so i want to update their field different to the non paying members.

So i need to find a way to check each and every record so that if the field DonatorDaysLeft is greater than 0 then do the first sql in the code below.. else do the other sql

But i don't know how to incorporate such an idea...

 

<?
$connect = mysql_connect("localhost", "root", "nottelling");

//error handle
if (!$connect) {
echo "Unable to connect to DataBase: " . mysql_error();
exit;
}

//error handle
if (!mysql_select_db("civilian")) {
echo "Unable to select table: " . mysql_error();
exit;
}

//something needs to be here
             
If ($DonateDays > 0){
$sql = "UPDATE userregistration SET CurrentEnergy=CurrentEnergy+10 WHERE CurrentEnergy<MaxEnergy";
$sqlresult = mysql_query($sql) or die(mysql_error());
Echo 'Success';
}
Else
{
$sql2 = "UPDATE userregistration SET CurrentEnergy=CurrentEnergy+5 WHERE CurrentEnergy<MaxEnergy";
$sqlresult = mysql_query($sql2) or die(mysql_error());
Echo 'Success2';
}
?>

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.