Re: Problem:
- From: Gordon <gordon.mcvey@xxxxxxxxxxxx>
- Date: Wed, 29 Oct 2008 04:21:38 -0700 (PDT)
On Oct 28, 4:55 am, rohit reja <rejarohit2...@xxxxxxxxx> wrote:
Hi everyone
I am developing a website..the form in my php page has a lot of
checkboxes..to set differebt options.
Now how do i write mysql query for that form according to checkbox
selected..is there any shorter way.
Plz help
Prepared statements and a foreach over your checkboxes.
foreach ($checkboxes as &$thisCheck)
{
$thisCheck?
$thicCheck = 1:
$thisCheck = 0;
}
$statement = $db -> prepare (UPDATE table SET item1=?, item2=? item3=?
WHERE id=?);
$statement -> execute (array ($checkboxes [0], $checkboxes [1],
$checkboxes [2], $id));
.
- Follow-Ups:
- Re: Problem:
- From: Michael Sherwood
- Re: Problem:
- References:
- Problem:
- From: rohit reja
- Problem:
- Prev by Date: Re: Issue with the casting of a SESSION variable
- Next by Date: Re: Issue with the casting of a SESSION variable
- Previous by thread: Re: Problem:
- Next by thread: Re: Problem:
- Index(es):
Relevant Pages
|