Database query for pull down option/menu

Josh Mellicker josh at dvcreators.net
Fri Feb 17 13:54:50 EST 2006


Wow! One I might be able to help on.

___________________________________________

In Revolution, put this script into your option menu:


ON menupick pChoice

         put pChoice into queryValue
         put  pChoice & " chosen" into field "status"

         get libUrlFormData("queryvalue", queryValue)
         post it to url "http://www.yourweburl.com/thepathtoyour/ 
phpscript.php"

         IF the result is empty THEN -- executed OK
             put it into fld "listOfFiles"
         ELSE
             put the result into field "task_desc" -- there was some  
error in executing the PHP script
         END IF


END menupick

___________________________________________

Now, make a text file on your server (called "phpscript.php" or  
"whatever.php"):


<?php
require_once('dbinfo.inc');   //this is the file with your connect info


$sql = "
SELECT
     myFileName

FROM
     fileNameTable
";

$result = mysql_query($sql) or die("Error #" . mysql_errno() . ":" .  
mysql_error() );


if (mysql_num_rows($result)) {

     //found at least one

     while ($row=mysql_fetch_array($result)) {
     echo $row['myFileName']."\n";
     }


} else {

//didn't find any

     echo "I did not find any records.";


}


?>




On Feb 16, 2006, at 9:59 PM, Benjamin Bacon wrote:

> Hi everyone,
>
> I am trying to create two pull down menu's that are based on MySQL  
> query's. Then based on what the user choses from the pull down  
> menu's they can get a listing of available files based on what is  
> already in the database. Can anyone help me on this one. I greatly  
> appreciate the help. I am quite fresh with Revolution development  
> and I have look in the manual and searched the web/documentation.
>
> Thanks!
> Benjamin
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your  
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
>
>




More information about the use-livecode mailing list