Announcement

Collapse
No announcement yet.

dynamic list box, part 2

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • dynamic list box, part 2

    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???)

  • #2
    Re: dynamic list box, part 2

    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?

    Comment


    • #3
      Re: dynamic list box, part 2

      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

      Comment


      • #4
        Re: dynamic list box, part 2

        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 &amp;&amp; $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...

        Comment


        • #5
          Re: dynamic list box, part 2

          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

          Comment


          • #6
            Re: dynamic list box, part 2

            oh dang, thx, i appreciate ya noticing that, i'll correct it [img]/ubbthreads/images/icons/smile.gif[/img]

            Comment


            • #7
              Re: dynamic list box, part 2

              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 [img]/ubbthreads/images/icons/smile.gif[/img]

              Comment


              • #8
                Re: dynamic list box, part 2

                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...=_project_help

                Corey Milner
                Creative Director, Indigo Rose Software

                Comment


                • #9
                  Re: dynamic list box, part 2

                  n/m, don't worry about it i was able to create a working script, thx tho

                  Comment


                  • #10
                    Re: dynamic list box, part 2

                    Right on...

                    Corey Milner
                    Creative Director, Indigo Rose Software

                    Comment


                    • #11
                      Re: dynamic list box, part 2

                      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

                      Comment

                      Working...
                      X