|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
MySQL 4.1 - Putting always fixed text in dropdown list box
Hi Everyone,
In the dropdown list box with auto increment properties, I inserting text & they are saving in the database. And at last I insert this "N/A" value. Bit if I insert another value later, then they are appear after "N/A". But I want to display always "N/A" at last in the front. So, How is it possibe? I m retriving the values from table & displaying in the list box. Plzzzz help... |
|
#2
|
||||
|
||||
|
Quote:
*blink* *blink* how can html have auto-increment? clarify what you are doing and asking please
__________________
life is a game.... Have fun ----------------------------- http://www.phpwomen.org strength in unity PHPCommunity IRC #phpc on freenode |
|
#3
|
|||
|
|||
|
display in the last position
Quote:
Actually, I m not typing manually in the <select></select>in the php page. I m retriving values from database. here N/A is the last. But if something inserted after N/A, then it will be displayed after N/A in the list. But I want to display always last position N/A in the list box, clear... So, is there any query??? |
|
#4
|
||||
|
||||
|
Why not leave the N/A Option out of the DB and just have the script put it in after it loads all the options from the DB? Another alternate option is to have N/A selected no matter where it is in the ordering returned from the db
Code:
if($option ==="N/A") { echo 'selected="selected"';}
anyway - if you absolutely must have the N/A as the last value - you will have to some fanagling. first thing that comes to mind is to make a look up table where the primary for N/A is either the smallest (1) or the largest in the listing so you can do a simple ORDER BY in your query. It will require a JOIN however if you want to know what the value for anything else though. You can't even order it based on the alphabet since N is right in the middle - which is why the look up table. |
![]() |
| Viewing: Codewalkers Forums > Other Technologies > Database Help > MySQL 4.1 - Putting always fixed text in dropdown list box |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
|
|
|