Fwd: enhanced_list_box

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



---------- Forwarded message ----------
From: kNish <singhai.nish@xxxxxxxxx>
Date: Nov 12, 2007 3:50 PM
Subject: enhanced_list_box
To: php-general@xxxxxxxxxxxxx


Hi,

          I am using this function enhanced_list_box. This works
fine. Except the return value is None. How is it possible for it to
return a proper value. It reads a list from a data base.

Brgds,

kNish

         <?php
               $db_artist = mysql_connect("ENG-3", "Any", "")or
die(mysql_error());
               mysql_select_db("daily",$db_artist)or die(mysql_error());
         ?>
         <?php
         $options = mysql_query("SELECT artist_name FROM artist");
         $options=mysql_fetch_array($options);
         echo '<td>';
          $test = enhanced_list_box_05(array(
               'table' => 'artist',
               'value_field' => 'artist_name',
               'highlight_id' => 1));
               echo "$test";
               function enhanced_list_box_05($options){
                       $sql = "select " . $options['value_field'];
                       $sql .= " from " . $options['table'];
                       $result = mysql_query($sql)or die("error in SQL");
                       echo '<select name="',
$options['value_field'],'" size="1">';
                       while ($row = mysql_fetch_array($result, MYSQL_NUM))
                       {
                               if($row[0] == $options['highlight_id']) {
                                       echo '<option value="' .
$row[0] . '"SELECTED>' . $row[0] . '</option>';
                               } else {
                                       echo '<option value="' .
$row[0] . '">' . $row[0] . '</option>';
                                       echo $row[0];
                               }
                       }
                       echo '</select>';
                       return $row[0];
               }
         echo '</td>';
         mysql_close($db_artist);
       ?>
     </tr>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux