26, 2006 12:04 PM
>>>To: mysql@lists.mysql.com
>>>Subject: Checkboxes
>>>
>>>I am trying to allow a user to use checkboxes for multiple
>>>selections, and I am trying to get the database to record
>>>the choices made by the user. I am using a VAR
use an integer and you need some kind of string
representation of the choice, use a secondary table to hold the string
values and let the integer in the main table be a foreign key to the
secondary table ;)
Nicholas Vettese wrote:
I am trying to allow a user to use checkboxes for multiple
Nicholas Vettese wrote:
I am trying to allow a user to use checkboxes for multiple selections, and I am trying to get the database to record the choices
made by the user. I am using a VARCHAR(250), but I am guessing that may be wrong. Also, other than adding a "[]" to the
end of
I am trying to allow a user to use checkboxes for multiple selections, and I am
trying to get the database to record the choices made by the user. I am using
a VARCHAR(250), but I am guessing that may be wrong. Also, other than adding a
"[]" to the end of the 'name' (e.g
) // $SQL will contain
"penpals.agegroup IN ( 00,01"
CALL FUNCTION ('check04','04',',', $First) // $SQL will contain
"penpals.agegroup IN ( 00,01,04"
$SQL .= " )"; // $SQL will cont
at
> other
> times the user will select more than one needing an OR statement between
> the
> two checkboxes. Make sense?
>
>
Use an array.
$agesel=implode("', '", $HTTP_GET_VARS['ageselect,]);
$qry="SELECT * FROM foo
WHERE penpals.agegro
ny checks, and because you rip the last or
and replace it with an and, you are always Ok for what follows.
> -Original Message-
> From: vernon [mailto:[EMAIL PROTECTED]
> Sent: Thursday, June 19, 2003 1:49 PM
> To: Mike Hillyer
> Subject: RE: Complex SQL involving 10
best regards
Peter
- Original Message -
From: "Mike Hillyer" <[EMAIL PROTECTED]>
To: "vernon" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Thursday, June 19, 2003 8:57 PM
Subject: RE: Complex SQL involving 10 checkboxes
Well, if one checkbox represents ages
e a code question. Essentially you just build the query in chunks. By
the nature of checkboxes you probably just need Ors, not ANDs. You may
need to rip the trailing OR, maybe replacing it with an AND if you need
to add some other condition on the end that needs an AND. Unless of
course someone can be
times the user will pick checkbox 1 and 5
but not 2,3,4,6, 7, 8, and 9. And then again there will be times when a user
only uses one check box needing the AND statement on the end, but at other
times the user will select more than one needing an OR statement between the
two checkboxes. Make se
Well, if one checkbox represents ages 1-5, another represents 6-9, and
another represents 10-15, then you have the checkboxes add where
clauses. Here is a pseudocode/basic example:
*START WITH A SELECT*
SQL = "SELECT * FROM TABLE WHERE"
*BUILD THE WHERE CLAUSES*
IF check1 THEN SQL = S
I'm trying to setup a SQL statement that involes using 10 different
checkboxes. The checkboxes repersent age groups that I need to forward to an
SQL statement. What would be the easiest way to do this?
As I think this through I'm thinking I have to check it 1 and 2 are checked
and n
12 matches
Mail list logo