What I want to do is next:
person makes a new post, let say it is a post for latest news. After form is populated, he/or she have a radio button or check-box to choose to display the latest news right away, or to wait for approval. I tried making a column 'visible' with the type of tinyint ... but no luck, because post is shown no matter if the tinyint value is '0', or '1'. Am i doing this wrong? '0' = false, '1' = true, right?
Example:
$headline = $_POST['headline'];
$news = $_POST['news_text'];
$visible = $_POST['visible'];
$query = "INSERT INTO news ( headline, news_text, visible) VALUES ($headline, $news_text, $visible");
<input type="radio" name="visible" value="0> No
<input type="radio" name="visible" value="1> Yes
Seem's a bit dull ... Help is appreciated ...
Make sure your visible
field is an INT field type (or TINYINT), and only make sure you use 0 or 1 for the value of that field.
So your table should look like this:
+----------+-----------+---------+
| headline | text | visible |
+----------+-----------+---------+
| Test 1 | Text One | 0 |
| Test 2 | Text Two | 1 |
+----------+-----------+---------+
Then, when you go to display the articles (only if visibility is 1):
SELECT headline, text
FROM tableName
WHERE visible = 1