vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   While loop only getting one row? (https://vborg.vbsupport.ru/showthread.php?t=319026)

Mickie D 06-10-2015 06:40 PM

While loop only getting one row?
 
Hi guys,

I can do this without vbulletin but as soon as I do this in vbulletin it only pulls one row

There is 6 rows it should pull from the database?

PHP Code:

    $dirsql $vbulletin->db->query_read("SELECT * FROM " TABLE_PREFIX "web WHERE file_userid = '$r1'");

        while (
$array $db->fetch_array($dirsql)){
 
                    
                    
$filerows '<h2 style="color: #3B4F9F;">'
                    
.$array['file_name'].
                    
'</h2><b>File Size: </b>' 
                    
.formatBytes($array['file_fullsize']).
                    
' - <b>Last Modified: </b>'
                    
.$array['file_timestamp'].
                    
'<br /><a href="webspace.php?deletefile='
                    
.$array['file_id'].
                    
'"><u>Delete File</u></a> - <a href="webspace.php?u='.$vbulletin->userinfo['username'].'&filedownloadid='
                    
.base64_encode($array['file_name']).
                    
'"><u>Download File</u></a><br /><br />';
            } 


Thank you all in advance

Mick

kh99 06-10-2015 06:44 PM

By using "$filerows =" in the loop, you're starting fresh with each iteration. If you're trying to build one string with all of them, you want .=

Mickie D 06-10-2015 06:51 PM

Quote:

Originally Posted by kh99 (Post 2547553)
By using "$filerows =" in the loop, you're starting fresh with each iteration. If you're trying to build one string with all of them, you want .=

Yes i had that in the first place (not sure why I removed it :(), you and dave taught me that the last time i needed help!

But you also inspired me to find that since writing that code I was not writing to the database the files at the same time...

The problem I had is it was not writing the files into the database so they was not showing more than one because there was only 1 file!

Also I want to upload the files with all the data can I do that in the same loop?

Thank you KH99


All times are GMT. The time now is 11:19 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.01348 seconds
  • Memory Usage 1,724KB
  • 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)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