473,386 Members | 1,864 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Checkbox not between date

Hello,

I get a database for « News » on Internet.
Side Admin, I would like a form to know witch "News" are Online or
not.
In my database mysql I get :

Date_start
and
Date_end

Outside this date, the « News » are unvisible.
In my form I put a checkbox « Off_line »

If it's check, all the news outside Date_start
And Date_end must be visible.
I tryed like this

In Head :
<?php
if (isset($HTTP_GET_VARS["date_off"]))
{
$ date_off =$HTTP_GET_VARS["date_off"];
}
else
{
$ date_off =0;
}
?>

In my form for checkbox :
<input <?php if ("CURRENT_DATE NOT BETWEEN $row_R_news['date_start']
AND $row_R_news['date_end'] ",1) {echo "checked=\"checked\"";} ?>
name=" date_off " type="checkbox" id=" date_off " value="1">
For my request sql :
SELECT t_news.*
FROM t_news
WHERE $date_off

Thanks to help me, pascal

Apr 18 '06 #1
2 1303
elia wrote:
Hello,

I get a database for « News » on Internet.
Side Admin, I would like a form to know witch "News" are Online or
not.
In my database mysql I get :

Date_start
and
Date_end

Outside this date, the « News » are unvisible.
In my form I put a checkbox « Off_line »

If it's check, all the news outside Date_start
And Date_end must be visible.
I tryed like this

In Head :
<?php
if (isset($HTTP_GET_VARS["date_off"]))
{
$ date_off =$HTTP_GET_VARS["date_off"];
}
else
{
$ date_off =0;
}
?>

In my form for checkbox :
<input <?php if ("CURRENT_DATE NOT BETWEEN $row_R_news['date_start']
AND $row_R_news['date_end'] ",1) {echo "checked=\"checked\"";} ?>
name=" date_off " type="checkbox" id=" date_off " value="1">
For my request sql :
SELECT t_news.*
FROM t_news
WHERE $date_off

Thanks to help me, pascal


First of all, what do actually get on your page? Next, have you looked at the
generated source?

One possibility I see is:

{echo "checked=\"checked\"";} ?>
name="

Looks like you don't have any space before name= if the box is checked.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Apr 18 '06 #2
Simply remove your WHERE condition from your SQL query when looking for
outdated news:
select * from t_news;
That's it!

Apr 18 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Jack | last post by:
Hi, I have a checkbox the value which goes to a database via a asp page that builds the sql string. In the front end asp page, the checkbox code is written as follows: <i><input...
1
by: N. Graves | last post by:
Hello I'm getting stumped and this is probably Access 101 but here goes. I have a list of To_do's When I click on a checkbox "Complete" I want automation to update a field called "Completed...
6
by: Megan | last post by:
Hi everybody- I'm trying to use a checkbox to control whether or not a date field in a query "Is Null" or "Is Not Null." I have 2 date fields: InDate and OutDate. If there is an OutDate, then...
1
by: dx | last post by:
I'm extremely frustrated with ASP.NET...again! To me this should be as simple as setting oCheckBox.Checked = True.. yet for some reason it isn't. I have a user control (ascx) that that has a...
1
by: Neal | last post by:
HI all, I have an issue with check box in datagrid. I would like it to check and uncheck based on a database value of NULL or a Date Value. If there is a date value for that column then check...
1
by: rodchar | last post by:
hey all, is the following even possible? i have a datagrid with checkboxes on each row, when a user clicks on the checkbox i'd like to populate one of the fields in the grid with the current...
17
by: Mike Fellows | last post by:
im trying (unsucessfully) to add a checkbox column to my datagrid i basically have a datagrid that im populating from a dataset Me.DataGrid1.DataSource = ds.Tables(0) the datagrid then has 5...
4
by: | last post by:
I have a checkbox on a web page. When it is checked, I want a Table to appear (or disappear when the checkbox is cleared)... I was hoping to use client side code for this, so I created a short...
34
by: clinttoris | last post by:
Hello Experts, I have been told to post this in the Javascript forum as I want to do this client side just before my form gets submitted. Once the user clicks the submit button a javascript...
2
by: livmacca | last post by:
Hi, I am trying to create a web page whereby I first read data from Oracle Database and display the records out on the data grid. The data displayed is in order of one attribute say 'A' meaning...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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,...

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.