Hi all:
Whew, I should take a class....but I'm one of those stubbornm teach-yourself guys.
Anywhoo, I am trying to create a pull-down menu of variables from a table named "categories" in my database that the user selects. Here's the code I used to create the table:
// --------- DISPLAY THE FORM ---------
// Create the pull-down menu information.
$query = "SELECT * FROM categories ORDER BY type ASC";
$result = @mysql_query ($query);
$pulldown = '<option>Select One</option>
';
while ($row = mysql_fetch_array ($result, MYSQL_ASSOC)) {
$pulldown .= "<option value=\"{$row['category_id']}\">{$row['category']}</option>\n";
}
In the HTML, here's what I used to display:
<td><font face="Arial,Helvetica,sans-serif" size="2" color="#000000"><b>Business Category:</b> </td>
<td><select name="category">
<?php echo $pulldown; ?>
</select></td>
</tr>
I'm successfully connecting to and inserting into the database prior to adding this code.
When I run the script, here's the error the config.inc file gives me:
An error occurred in script /home/souther2/public_html/templates/config.inc on line 10: mysql_query(): Access denied for user: 'souther2@localhost' (Using password: NO)
An error occurred in script /home/souther2/public_html/templates/config.inc on line 10: mysql_query(): A link to the server could not be established
An error occurred in script /home/souther2/public_html/templates/config.inc on line 10: mysql_fetch_array(): supplied argument is not a valid MySQL result resource
Ideas? Thanks for all your help today--I know I've been a pain in the butt.
Eric
mysql_fetch_array plus other errors
Moderator: General Moderators