vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   code problem (https://vborg.vbsupport.ru/showthread.php?t=68214)

DeadGaze 08-10-2004 09:51 PM

code problem
 
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 {
}


filburt1 08-10-2004 09:56 PM

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']; 


DeadGaze 08-11-2004 09:21 AM

ow iam sorry hehe
well the code is working now
but the wrong way hehe
i wanted to have a code when switching from day he do it but now he stay entering the code
till it is the next day
only wanted to do the code when the switch is going to the next day
PHP Code:

$result $DB_site->query_first("SELECT * FROM other WHERE time"); // shouldn't there be a WHERE clause?
$daytoday1 $result['time'];
$time1_today=date("D d-m-y");
//$daytoday1=$DB_site->query("SELECT * FROM other WHERE time");
if ($daytoday1 == $time1_today) {
    
$DB_site->query("UPDATE other SET test='$time1_today'");

} else {
     
$DB_site->query("UPDATE other SET time='$time1_today'");
$DB_site->query("UPDATE user SET level=level-1");


Thanxs


All times are GMT. The time now is 08:08 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01068 seconds
  • Memory Usage 1,728KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (3)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (3)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete