473,473 Members | 1,584 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

how can i display 1 and 0 as active and inactive

1 New Member
if i inserted this in database it will set as 1 or 0

but i want to pull it and display as active and inactive

<select name="status">
<option value="1">Active</option>
<option value="0">Inactive</option>
</select>
Aug 28 '14 #1
2 12836
Luuk
1,047 Recognized Expert Top Contributor
Expand|Select|Wrap|Line Numbers
  1. select i, case i when 1 then 'active' else 'inactive' end ANSWER from ints 
  2. where i=1;
  3.  
this shows:
Expand|Select|Wrap|Line Numbers
  1. +---+--------+
  2. | i | ANSWER |
  3. +---+--------+
  4. | 1 | active |
  5. +---+--------+
  6.  
Aug 28 '14 #2
Exequiel
288 Contributor
i think you can do it this way.
sample table.

-------status-------
id | statusname |
----------------
1 | 1 | //for active
---------
2 | 0 | //for inactive
---------

sample code to view

Expand|Select|Wrap|Line Numbers
  1. $htmlstat = "";
  2. $string = "";
  3.  
  4. $status = mysql_query("SELECT * FROM status");
  5. while($stat = mysql_fetch_array($status))
  6. {
  7.    if($stat['statusname'] == 1)
  8.    {
  9.       $string = "Active";
  10.    }
  11.    else
  12.   {
  13.      $string = "Inactive";
  14.   }
  15.    $htmlstat += '<option value="'.$stat['status'].'">'.$string.'</option>';
  16.  
  17. }
  18. echo '<select name="status">'.$htmlstat.'</select>';
[/code]
Aug 28 '14 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Kelly | last post by:
I have a subform that display requisition information. One of the fields in the subform is a combo box that shows who requested the requisition. The users can change who requested the requisition...
2
by: LCK | last post by:
Hi Is it possible to change the appearance/color of certain items inside a listbox? To indicate if some items are active. Example Listbox:
8
by: salad | last post by:
I was wondering how you handle active/inactive elements in a combo box. Let's say you have a combo box to select an employee. Joe Blow has been selected for many record however Joe has left the...
1
by: Regnab | last post by:
I've got a form where the user can edit the lookups available in the database. It consists of a list box of the various categories on the main form, a checkbox on the main form and a sub form which...
2
by: j.m.osterman | last post by:
I haven't found exactly what I've been trying to do. All I am trying to do for now is just display usernames from Active Directory into a ListBox control on a page. I have found some code...
2
by: Izu | last post by:
Is it possible to display the DNS entries on a Domain controller on a webpage?
1
by: OxfordConsult | last post by:
I have a form in which a selection in a list box pulls a record to be displayed in a subform. All contacts are categorised as either Active, Inactive, or left company. I was wondering if it is...
2
by: beemomo | last post by:
hi everyone! i am using an active x control : date time picker in an access form that bound to date field in a table. Whenever it is displayed on my machine, the control can be displayed and...
20
by: Scldb | last post by:
I have a form needs to be filled out. A lot of the questions are a yes/no question. When they pick yes I want some other textboxes to be active, and when they pick no I want the textboxes to be...
5
by: HSXWillH | last post by:
Okay, as I said in my last question about setting up a variable Field-Name to gain initial focus, I'm building a database that will split/manipulate a shorthand code/text and put it in various fields...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.