View Full Version : dynamic list box, part 2
intel352
01-26-2003, 09:25 AM
okay, i read the post Dynamic List Box, and while proving that a dynamic list box is possible, it raises a couple more questions for me in relation so my own angle w/ my installer....
okay, i would like to have a dynamic list box, in which the variable (used to create the dynamic list) is filled by a GET function to my web database of files... i would like it to dynamically list the downloads that i have, and the filesize too if possible, and then once a file is selected, download the selected file...
in my database, i have the filename, filesize, fileurl, as well as more info on each file, but how would i request information to the variable so that the listbox shows name/size, and also retains the proper url for the file?? i believe this is beyond my limited skill, unless some1 can give me a bit of direction... thx
(btw, would it be best for me to have one get function GET/create the file list, then once the files are selected and Next is clicked, it then GETs the total filesize to be downloaded, and then Next is clicked again, and the installer GETs the fileurl???)
intel352
01-26-2003, 10:09 AM
okay, i played around a bit using the code posted by GeoTrail in "Thread Deleted?"
i have my installer able to retrieve the database file, but it only gets the first one, so i'm thinking i would have to create a while loop and then add each retrieved piece of info into a string or .txt file, which i would then use to populate the list box? does this sound plausible?
Corey
01-26-2003, 04:36 PM
You should do most of that server side, i.e. have a script which auto-generates the correct content list and info in a format which is "ready" for SF.
Trying to do all that stuff on the fly as opposed to in a "chunk" offers no benefit that I can see.
Corey Milner
Creative Director, Indigo Rose Software (http://www.indigorose.com)
intel352
01-26-2003, 06:28 PM
okay, using your suggestion to do the work serverside, i made this script that appears to having trouble w/ the action associated w/ $list2:
//====================================
$link = mysql_connect($host, $user, $pass) or die("Could not connect to server!");
$db = mysql_select_db($database, $link) or die("Could not select database!");
$list = mysql_query("SELECT COUNT(*) FROM `dl1_downloads`");
while ($string = mysql_fetch_array($list)) {
$dltotal = $string["COUNT(*)"];
}
$id = 1;
while ($id > 0 && $id <= $dltotal) {
$list2 = mysql_query("SELECT dlid, dltitle, dlurl, dlsize FROM `dl1_downloads` ORDER BY `dltitle` WHERE dlid='$id'");
while ($string = mysql_fetch_array($list2)) {
$title = $string["dltitle"];
$url = $string["dlurl"];
$size = $string["dlsize"];
}
$info .= "$title, $url, $size;";
$id ++;
}
echo"<SUF60>%info%</SUF60>"; //This line tells which variables to send to the installation
echo"<%info%>$info</%info%>";
//====================================
and here's the error i'm getting:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/virtual/site45/fst/var/www/html/downloadquerytest.php on line 23
any idea what i did wrong? i'm a n00b to scripting, so i'm trying figure it out as i go...
Corey
01-26-2003, 08:08 PM
I'm no debug expert but at a glance could it be this line?
$info .= "$title, $url, $size;";'
It seems like you should escape the semi-colon...
Corey Milner
Creative Director, Indigo Rose Software (http://www.indigorose.com)
intel352
01-26-2003, 08:09 PM
oh dang, thx, i appreciate ya noticing that, i'll correct it /ubbthreads/images/icons/smile.gif
intel352
01-26-2003, 08:12 PM
no, that wasn't it, since the semi-colon was in quotes, it was actually including that as part of the echo... i removed it, just in case, and same error occurs
thx for that suggestion anyways /ubbthreads/images/icons/smile.gif
Corey
01-26-2003, 09:26 PM
I'll have to take a closer look later when I get a few minutes, you might also want to post to our project help forum:
http://www.indigorose.com/ubbthreads/postlist.php?Cat=&Board=_project_help
Corey Milner
Creative Director, Indigo Rose Software (http://www.indigorose.com)
intel352
01-27-2003, 11:11 PM
n/m, don't worry about it i was able to create a working script, thx tho
Corey
01-27-2003, 11:27 PM
Right on...
Corey Milner
Creative Director, Indigo Rose Software (http://www.indigorose.com)
intel352
01-27-2003, 11:33 PM
hey corey, i posted in that other forum, if you get a chance to check it
it's a slightly diff question, still concerning the listbox
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.