PDA

View Full Version : While loop only getting one row?


Mickie D
06-10-2015, 06:40 PM
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?


$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
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