Re: Problem:



rohit reja 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

Build your sql query with sequential if statements.

$sql = "SELECT blah FROM foobar WHERE doe='rae';
if ($check1 == 'on') $sql .= ' AND blahblah';
.....
.....
.



Relevant Pages

  • Problem:
    ... 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 ... Plz help ...
    (comp.lang.php)
  • Re: Problem:
    ... 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. ...
    (comp.lang.php)
  • Re: [PHP] Bizarre array create error
    ... I'm trying to assign two fields of an object returned from a MySQL query and have stumbled upon the most bizarre PHP bug where I can't create two arrays in succession. ... If I comment out either of the above lines, the script works but with both uncommented, it seems to drop dead. ...
    (php.general)
  • Bizarre array create error
    ... I'm trying to assign two fields of an object returned from a MySQL query and have stumbled upon the most bizarre PHP bug where I can't create two arrays in succession. ... I did a "show invisibles" and "show spaces" in BBEdit to see if there was a hidden character, ...
    (php.general)
  • Re: [PHP] Bizarre array create error
    ... I'm trying to assign two fields of an object returned from a MySQL query and have stumbled upon the most bizarre PHP bug where I can't create two arrays in succession. ... I did a "show invisibles" and "show spaces" in BBEdit to see if there was a hidden character, ...
    (php.general)