Quote:
Originally Posted by DeadGaze
HElp
i created the following code
but i dosnt get what i want can someone make it for me good
thanxss
Code:
$time1_today=date("D d-m-y");
$daytoday1=$DB_site->query("SELECT time FROM other");
if ($daytoday1 == $time1_today) {
$DB_site->query("UPDATE other SET time='$time1_today'");
$DB_site->query("UPDATE user SET level=level-1");
} else {
}
|
1. You need to describe what your code is supposed to be doing.
2. Please surround your code with [php] tags instead of [code] tags to enable color formatting.
3. The else block is redundant and can be deleted.
4. I strongly recommend that you get in the habit of indenting your code. For example:
PHP Code:
$time1_today = date("D d-m-y");
$daytoday1 = $DB_site->query("SELECT time FROM other");
if ($daytoday1 == $time1_today)
{
$DB_site->query("UPDATE other SET time='$time1_today'");
$DB_site->query("UPDATE user SET level=level-1");
}
5. The $daytoday1 variable is not set to what you expect. The proper replacement:
PHP Code:
$result = $DB_site->query_first("SELECT time FROM other"); // shouldn't there be a WHERE clause?
$daytoday1 = $result['time'];