vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Script ignores first entry in database (https://vborg.vbsupport.ru/showthread.php?t=34842)

Lesane 02-06-2002 05:02 PM

With the following code i try 2 get the awards out of the database, when i have one award like this one:

awardsid=19 and aw=19 then it shows it on the postbit

now when i add a second award with these variables:

awardsid=16 and aw=0 then nothing will be showed, the first award will be ignored

when i change the second award to awardsid=16 and aw=16 then it shows that second award on the postbit...

so when i add a second award then it fully ignores the first entry/award :noid:

Does someone have a solution for this problem because i get paranoid :D

I'm using this code:

PHP Code:

if ($post[award]=="1"
   {
     
$awards=$DB_site->query("SELECT aw,awardsid,name, url FROM award");
     while (
$award=$DB_site->fetch_array($awards)) {
     if (
$award[aw] == $award[awardsid]) {
        eval(
"\$post[hasaward] = \"".gettemplate("awards")."\";");
    } 
else {
     
$post[hasaward]="nope";
     } 
}



Admin 02-06-2002 05:27 PM

Not sure I follow you, at all, but try changing this:
PHP Code:

        eval("\$post[hasaward] = \"".gettemplate("awards")."\";"); 

to this:
PHP Code:

        eval("\$post[hasaward] .= \"".gettemplate("awards")."\";"); 

since you are ADDING to the current variable, not re-creating it.

Lesane 02-06-2002 05:35 PM

You are a lifesaver, thanks man.

Lesane 02-13-2002 01:54 PM

hmm..how spooky is this? I got the hack almost finished and now the code dont works anymore, i'm using this code at the moment:

PHP Code:

if ($post[award]=="1"
   {
     
$awards=$DB_site->query("SELECT * FROM useraward where userid=$post[userid]");
     while (
$award=$DB_site->fetch_array($awards)) 
     {
          if (
$award[awardsid] == $award[aw]) 
          {
             eval(
"\$post[hasaward] .= \"".gettemplate("awards")."\";");
          } else {
           
$post[hasaward]="";
          } 
     }
   } 

I have currently 3 awards in the database.

Lesane = checked
Lala = checked
Cool = not checked

It must display lesane + lala because they are checked but it displays nothing, it listen only to cool. When i have cool = checked then it displays everything so the script listen again only to the last entry in the database :confused:


Do you see any problem in the code that i dont see or do you know an other way? Thanks.


All times are GMT. The time now is 11:18 AM.

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.01057 seconds
  • Memory Usage 1,727KB
  • 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
  • (4)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (4)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