Fwd: enhanced_list_box

From: Date: Tue, 13 Nov 2007 10:04:59 +0000
Subject: Fwd: enhanced_list_box
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-264427@lists.php.net to get a copy of this message
---------- Forwarded message ---------- From: kNish <singhai.nish@gmail.com> Date: Nov 12, 2007 3:50 PM Subject: enhanced_list_box To: php-general@lists.php.net 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>

« previous php.general (#264427) next »