CheeserTheAverage
asked on
How does mysql_fetch_assoc store rows from a query?
I am using Dreamweaver's built in functionality to create a drop down list from a MySQL query. The problem I have is that if I try to duplicate the list on the same page, only the first instance is filled with info from the query. It may have something to do with the way "mysql_fetch_assoc" counts through the rows. Can someone please explain how this works and how I can create multiple lists from the one query? Thanks.
// The following is a couple snippets from my page:
mysql_select_db($database_gw2000Connect, $gw2000Connect);
$query_getAllNames = "SELECT * FROM users";
$getAllNames = mysql_query($query_getAllNames, $gw2000Connect) or die(mysql_error());
$row_getAllNames = mysql_fetch_assoc($getAllNames);
$totalRows_getAllNames = mysql_num_rows($getAllNames);
<select name="entryToApply">
<?php do { ?>
<option value="<?php echo $row_entriesToApply['invoiceNum']; ?>">
<?php echo $row_entriesToApply['invoiceNum']; ?>
</option>
<?php } while ($row_entriesToApply = mysql_fetch_assoc($entriesToApply)); ?>
</select>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.