czukoman20 Posted June 18, 2008 Share Posted June 18, 2008 I have this drop down menu, and i want it to be able to look at what the user has in the database, and then i would like it to show up in the drop down as the default when the user goes into edit account <tr><td>Type of Market:</td> <td><label> <select name="type_market" id="type_market"> <option value="sto">Stocks </option> <option value="com">Commodities</option> <option value="edu">Education</option> <option value="fin">Financial Planning</option> <option value="mort">Mortgages</option> </select> I want to make this take this value <? echo $req_user_info['type_market']; ?> kinda like how you would insert the text that they already have in the text box, but instead for a drop down menu also just a side question.. What mysql query can i use to update a whole column in the database to = 0 help is appreciated thanks Quote Link to comment Share on other sites More sharing options...
hitman6003 Posted June 19, 2008 Share Posted June 19, 2008 Have a check for the value in the row for each item in the select: <option value="sto" <?php echo $req_user_info['type_market'] == "sto" ? 'selected="selected" : ''; ?>>Stocks </option> [quote]What mysql query can i use to update a whole column in the database to = 0[/quote] Don't use a WHERE clause... [code]UPDATE table_name SET column = 0; [/code] Quote Link to comment Share on other sites More sharing options...
czukoman20 Posted June 19, 2008 Author Share Posted June 19, 2008 thanks Quote Link to comment Share on other sites More sharing options...
czukoman20 Posted June 19, 2008 Author Share Posted June 19, 2008 <option value="sto" <?php echo $req_user_info['type_market'] == "sto" ? 'selected="selected" : '; ?>>Stocks </option> i get an error message saying that the semicolon is an issue. if its there or isn't there Quote Link to comment Share on other sites More sharing options...
hitman6003 Posted June 19, 2008 Share Posted June 19, 2008 You have some misplaced single quotes. Also, it may help to put the expression in parenthesis: <?php echo ($req_user_info['type_market'] == "sto" ? 'selected="selected"' : ''); ?> Quote Link to comment Share on other sites More sharing options...
czukoman20 Posted June 20, 2008 Author Share Posted June 20, 2008 thanks that worked.. ok well one last question mysql_query(""); What should i input if i want to delete all information from a particular column but still keep the column Quote Link to comment Share on other sites More sharing options...
Stephen Posted June 20, 2008 Share Posted June 20, 2008 You could try doing: mysql_query("UPDATE table SET column=''"); Quote Link to comment Share on other sites More sharing options...
czukoman20 Posted June 20, 2008 Author Share Posted June 20, 2008 ok well i figured it out Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.