vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   text not echoing out (https://vborg.vbsupport.ru/showthread.php?t=67621)

sabret00the 07-25-2004 02:36 PM

text not echoing out
 
PHP Code:

    $latestconfession $DB_site->query_first ("
                     SELECT COUNT(*) AS votes, confessions.confessionid, confessions.visible,
                     confessions.text, confession_rate.rate, user.username
                     FROM confessions
                     LEFT JOIN confession_rate ON (confessions.confessionid = confession_rate.confessionid)
                     LEFT JOIN user ON (user.userid = confessions.userid)
                     WHERE confessions.visible = 1
                     GROUP BY confessions.confessionid
                     ORDER BY confessions.confessionid DESC
                     LIMIT 1 
                 "
);
 
     
$latestconfession_info $DB_site->fetch_array($latestconfession);
 
     
$latestconfession_info['text'] = nl2br(stripslashes($latestconfession_info['text']));
     if (
strlen($latestconfession_info[text]) > 150)
     {
         
$latestconfession_info['text'] = substr($latestconfession_info['text'],0,150)."...";
     }
 
     
$latestconfession_info_text "$latestconfession_info[text]";
     
$latestconfession_info['num_rates'] = number_format($latestconfession_info['votes']);
     
extract($latestconfession_info);
 
     eval(
'$siteindex_contentbox .= "' fetch_template("siteindex_confessions") . '";'); 

the problem is that $latestconfessions_info_text isn't eachoing out into the template :(

amykhar 07-25-2004 02:40 PM

If it's 0, it won't. Try echoing $latestconfessions_info_text + "Test". If that works, you'll know your text isn't getting set.

sabret00the 07-25-2004 02:54 PM

i tried that and it never worked, yet i know the text is there as i can get it via the query, i'm not quite sure where i've gone wrong from doing the query to trying to echo it out as it seems to be getting lost.

Modin 07-25-2004 03:22 PM

You don't need to fetch the array after calling the function "$DB_site->query_first()". query_first already returns an array of the first row of the result.

So try removing
Code:

$latestconfession_info = $DB_site->fetch_array($latestconfession);
and then fix up your variables to match.

Colin F 07-25-2004 03:44 PM

Check that this whole thing is not in an if or while clause that's not being executed.

Do you have a template siteindex_confessions? (ok, rather basic question, but spelling errors can happen :))

why do you call $latestconfession_info_text instead of just $latestconfession_info[text] ??
You might also want to take away those ""'s

sabret00the 07-25-2004 04:07 PM

thanks both of you, the working code is now

PHP Code:

    $latestconfession $DB_site->query_first ("
                    SELECT COUNT(*) AS votes, confessions.confessionid, confessions.visible,
                    confessions.text, confession_rate.rate, user.username
                    FROM confessions
                    LEFT JOIN confession_rate ON (confessions.confessionid = confession_rate.confessionid)
                    LEFT JOIN user ON (user.userid = confessions.userid)
                    WHERE confessions.visible = 1
                    GROUP BY confessions.confessionid
                    ORDER BY confessions.confessionid DESC
                    LIMIT 1 
                "
);

    
$latestconfession['text'] = nl2br(stripslashes($latestconfession['text']));
    if (
strlen($latestconfession[text]) > 150)
    {
        
$latestconfession['text'] = substr($latestconfession['text'],0,150)."...";
    }

    if (
$latestconfession['rate'] == NULL)
    {
        
$latestconfession['rate'] = "0";
    }

    eval(
'$siteindex_contentbox .= "' fetch_template("siteindex_confessions") . '";'); 


Modin 07-25-2004 11:16 PM

great to see :D


All times are GMT. The time now is 06:06 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.01712 seconds
  • Memory Usage 1,739KB
  • 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
  • (1)bbcode_code_printable
  • (2)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (7)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