0

For some reason this function OMITS this very first row of my vType query.

The $vType is the name of my List
The $FieldValue is the value in the field associated record I am building the options for. It can contain a single or MULTIPLE values.

I appreciate any help that can be offered ;-)

function Get_Menu_Selected ($vType, $FieldValue) {

$options .= "<option value=\"\"></option>\n";
$qry = "select `vValue` FROM `vLists` where `vType`='$vType' ORDER BY `Sort` ASC";
$result=mysql_query($qry);
$row=mysql_fetch_array($result);
$vValue = $row['vValue'];
$selected = explode('\r',$FieldValue);
//$options = '';

while($row=mysql_fetch_array($result)) {
$inst = $row['vValue']; 
  $sel = '';
  if ( in_array($inst,$selected) ) {
	$sel = 'selected="selected " ';
  }
  $options .= "<option {$sel}value=\"{$inst}\">{$inst}</option>\n";
} return $options;
}
2
Contributors
1
Reply
2
Views
8 Years
Discussion Span
Last Post by ShawnCplus
0
$row=mysql_fetch_array($result);
$vValue = $row['vValue'];

You're fetching one row before your while loop so its essentially doing nothing with the first row

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.