Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
Eagle_f90
Constraint Violating Yak Guru
424 Posts |
Posted - 2004-06-21 : 21:20:24
|
I have a script which is supposed to make two drop down menus based on information from a DB. The issue is not all the info from the DB is put to the dropdown menus and the submit form is not there. I have been looking at the code for about 3 days now and can't figure it out. Can someone take a look at it and see if they can find it.Note: This is only the portion of the script taht is having the issue, the connection to the db is already done.<td>Give an item:<form action="give.asp" method="post"><select name="give"><option value="no" selected="selected">Don't Give any items</option><%if trim(objrs("item1")) <> "None" then%><option value="<%=trim(objrs("item1"))%>><%=trim(objrs("item1"))%></option><%end if%><%if trim(objrs("item1")) <> "None" then%><option value="<%=trim(objrs("item2"))%>><%=trim(objrs("item2"))%></option><%end if%><%if trim(objrs("item1")) <> "None" then%><option value="<%=trim(objrs("item3"))%>><%=trim(objrs("item3"))%></option><%end if%><%if trim(objrs("item1")) <> "None" then%><option value="<%=trim(objrs("item4"))%>><%=trim(objrs("item4"))%></option><%end if%><%if trim(objrs("item1")) <> "None" then%><option value="<%=trim(objrs("item5"))%>><%=trim(objrs("item5"))%></option><%end if%></select><br />To: <%objrs.closedim strplayersstrplayers = "select * from playerinfo"objrs.open strplayers, objconn%><select name="to"><option value="no" selected="selected">No one</option><%do while not objrs.eof%><option value="<%=trim(objrs("playerid"))%>><%=trim(objrs("player_name"))%></option><%objrs.movenextloop%></select><br /><input type="submit" value="Give an Item" /></form></td> Also when I look at the "view sorce" from IE for this page this is what is shown:<td>Give an item:<form action="give.asp" method="post"><select name="give"><option value="no" selected="selected">Don't Give any items</option></select><br />To: <select name="to"><option value="no" selected="selected">No one</option><option value="test>Test Player</option><option value="Evil Fan>Evil #1 Fan</option><option value="Diablos>Diablos</option><option value="Goten>Son Goten</option><option value="Vegeta>Vegeta</option><option value="Chii>Chii Hellsing</option><option value="Trunks>Majin Trunks</option></select><br /><input type="submit" value="Give an Item" /></form></td> --For those with wings, fly to your dreamsDearms are what are found at the end of reality, and your reality if what is found at the end of your dreams. |
|
Kristen
Test
22859 Posts |
Posted - 2004-06-22 : 01:04:22
|
Here are some suggestions, looks like you are missing some quotes:<td>Give an item:<form action="give.asp" method="post"><select name="give"><option value="no" selected="selected">Don't Give any items</option><%if trim(objrs("item1")) <> "None" then%><option value="<%=trim(objrs("item1"))%>"><%=trim(objrs("item1"))%></option><%end if%><%if trim(objrs("item1")) <> "None" then%><option value="<%=trim(objrs("item2"))%>"><%=trim(objrs("item2"))%></option><%end if%><%if trim(objrs("item1")) <> "None" then%><option value="<%=trim(objrs("item3"))%>"><%=trim(objrs("item3"))%></option><%end if%><%if trim(objrs("item1")) <> "None" then%><option value="<%=trim(objrs("item4"))%>"><%=trim(objrs("item4"))%></option><%end if%><%if trim(objrs("item1")) <> "None" then%><option value="<%=trim(objrs("item5"))%>"><%=trim(objrs("item5"))%></option><%end if%></select><br />To: <%objrs.closedim strplayersstrplayers = "select * from playerinfo"strplayers = "select playerid from playerinfo"... you should NEVER use SELECT * like this ...objrs.open strplayers, objconn%><select name="to"><option value="no" selected="selected">No one</option><%do while not objrs.eof%><option value="<%=trim(objrs("playerid"))%>"><%=trim(objrs("player_name"))%></option><%objrs.movenextloop%></select><br /><input type="submit" value="Give an Item" /></form></td> You should not use SELECT * ever - although there are some rare exceptions, like EXISTS (SELECT * FROM ...The reason is that the server will return all the columns in the table, which is slow. Particularly if there is a TEXT column in that table - hey, what will happen if you add a TEXT column - or maybe 6 TEXT columns - to that table later? Yup, every SELECT * query will download them from the server and take MORE time!Also SQL has to spend time working out what "*" means each time, i.e. work out what all the column names are, also slow.Kristen |
|
|
Eagle_f90
Constraint Violating Yak Guru
424 Posts |
Posted - 2004-06-22 : 04:51:45
|
Thank you for your suggestion, I will make that change. And thank you for seeing what I never did, you where right it was them dang quotes.--For those with wings, fly to your dreamsDearms are what are found at the end of reality, and your reality if what is found at the end of your dreams. |
|
|
|
|
|
|
|