After much googling to no avail, I am hoping someone can help me figure out how I can create a table of some information where the last column is just a column of radio buttons for each row. Something Like this:
ID | First Name | last Name |Select
1 | John | Smith | O (radio button)
MySQL doesn't store "radio buttons". That's not a datatype.
Think about what a "radio button" is. How does the state of a "radio button" get set on display, and get passed back in a form?
A "radio button" has a property "checked", which is either TRUE or FALSE.
If you want to store a "radio button" for a row in a database table, what you really want to store is the state of "checked" property... either TRUE or FALSE.
The easiest way to do that in MySQL is to define a column. Give the column a meaningful name, but for sake of illustration...
radio_button_state TINYINT(1) UNSIGNED NOT NULL DEFAULT '0' COMMENT 'boolean'
A value of 0 is equivalent to FALSE. Any other non-NULL value would be equivalent to TRUE. (And if your column allows for NULL values, a NULL would just be NULL (which is neither TRUE or FALSE.)
There are lots of other ways to implement boolean values in a database column.
Some developers like to store character strings, like 'Y'/'N' or 'T'/'F'. Some developers argue for storing binary types like
But for maximum ease of use and portability, an integer type is the way to go.
Again, in terms of evaluating the value of the column in SQL...