vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   Loop in PHP Direct Execution (https://vborg.vbsupport.ru/showthread.php?t=241737)

ocean86 05-02-2010 07:48 PM

Loop in PHP Direct Execution
 
Hi,
I create a widget type "PHP Direct Execution". In the PHP code that I've written, there is a cycle (while). When I insert this PHP code in the widget, the cycle doesn't function. Only the last result of the query it's printed.

This is the PHP Code:
PHP Code:

$db_host "localhost";
$db_user "user";
$db_password "pwd";
$db_name "database";
$db mysql_connect($db_host$db_user$db_password);
mysql_select_db($db_name$db);

$countdown_true "1";
$query_ViewCountdown mysql_query("SELECT * FROM city WHERE countdown='$countdown_true'"$db);
$num_rows mysql_num_rows($query_ViewCountdown);
if (
$num_rows 0)
while(
$row mysql_fetch_array($query_ViewCountdown)){
$username $row['id_user'];
$nave $row['id_nave'];
$testo "Pinco pallino parte $username davvero tanto bravo $nave "; }
$output $testo"<br />";


Why the cycle isn't execute?

Thank you and excuse me for bad english!

bpr 05-02-2010 07:58 PM

change $output = $test to $output .= $testo

that should solve your problem

ocean86 05-11-2010 05:26 PM

I've done what you tell me but the problem isn't solved.

Other?

Thank you

bpr 05-11-2010 07:27 PM

what about

$output = $testo; "<br />";

to

$output .= $testo . "<br />";

there was an ; instead of an / between $testo and br


All times are GMT. The time now is 03:29 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.01513 seconds
  • Memory Usage 1,718KB
  • 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_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