Quick question. I'm a table, which might have the same name repeated in several rows, to populate a select list:
As you can see, if there is more then one entry with the same name the select list will list the name several times.Code:$recordset = mssql_query ("select * from purchaseorder order by reqname", $handle); while($arr = mssql_fetch_row($recordset)) { $name = $arr[1]; echo "<option>$name"; }
I can't seem to think of a way to avoid this, but I know there must be a way.
For instance:
Although I know my if statment is not valid, how do you pros do it?Code:$recordset = mssql_query ("select * from purchaseorder order by reqname", $handle); while($arr = mssql_fetch_row($recordset)) { if($name == '%$totallist%') { $name = $arr[1]; echo "<option>$name"; } $totalnames = "$totalnames $name"; }


Reply With Quote
Bookmarks