I am having a problem with reseting my query results. I want to take
$results and have it spit it out line by line - but twice. I have found that
after the first time through, it just spits out 15 (in this case) more blank
lines.
Any help? (My code is below)
------------------------------------
This code is to create an HTML drop down list of the results.
Here is the function to display the box - it works fine:
class display
{
function form_dropdown ($list_array, $name)
{
// default name code
if (!isset($name))
{
$name = "default";
}
$database = new database;
$rows = $database->rows($list_array);
$field_name = mysql_field_name($list_array, 0);
?>
<select name="<? echo $name; ?>">
<option>Select One</option>
<?
for ($i=0; $i <$rows; $i++)
{
$row = mysql_fetch_array($list_array);
echo "<option>".$row[$field_name]."</option>";
}
?></select><?
}
}
Here is the query and call script:
$query = "SELECT username
FROM `user`
ORDER BY username ASC";
// These three lines connect to the database, run the query, and get a row
tally.
$database = new database;
$result = $database->query($query);
$result_row = $database->rows($result);
?><form name="User Select" method="post" action="transcriptlist.php"><?
$display = new display;
// First drop down - WORKS
echo "User1";
$name = "User1";
$display->form_dropdown($result, $name);
echo "<br>";
// Second drop down - ONLY BLANK LINES!
echo "User2";
$name = "User2";
$display->form_dropdown($result, $name);
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php