Re: [PHP] Selecting checkboxes based on SQL query

2012-02-23 Thread Jim Lucas
On 02/23/2012 11:30 AM, Rick Dwyer wrote: So, to use my existing function, how do I get the following array to look like the above one: Array ( [0] => Array ( [cb] => 2 ) [1] => Array ( [cb] => 6 ) [2] => Array ( [cb] => 1 ) ) $d = $a = array(); foreach ($d AS $r) $a[] = $r['cb']; -- Jim L

Re: [PHP] Selecting checkboxes based on SQL query

2012-02-23 Thread Fatih P.
On Thu, Feb 23, 2012 at 9:30 PM, Rick Dwyer wrote: > I should have been more explicit in my description... > > The SQL command that returns the array is not the same one that creates > the checkboxes they are two different sql queries and I would prefer to > keep them that way. > > I actually

Re: [PHP] Selecting checkboxes based on SQL query

2012-02-23 Thread Rick Dwyer
I should have been more explicit in my description... The SQL command that returns the array is not the same one that creates the checkboxes they are two different sql queries and I would prefer to keep them that way. I actually have it working for a form submit with a custom function I

Re: [PHP] Selecting checkboxes based on SQL query

2012-02-23 Thread Fatih P.
On Thu, Feb 23, 2012 at 8:49 PM, Rick Dwyer wrote: > Hello all. > > I perform a SQL query like the following: > > $sql = 'select * from my_table where id="10" > > It returns the the following array for 3 records: > > > Array ( [0] => Array ( [cb] => 2 ) [1] => Array ( [cb] => 6 ) [2] => Array > (

Re: [PHP] Selecting checkboxes based on SQL query

2012-02-23 Thread Matijn Woudt
On Thu, Feb 23, 2012 at 8:07 PM, Matijn Woudt wrote: > On Thu, Feb 23, 2012 at 7:49 PM, Rick Dwyer wrote: >> Hello all. >> >> I perform a SQL query like the following: >> >> $sql = 'select * from my_table where id="10" >> >> It returns the the following array for 3 records: >> >> >> Array ( [0] =

Re: [PHP] Selecting checkboxes based on SQL query

2012-02-23 Thread Matijn Woudt
On Thu, Feb 23, 2012 at 7:49 PM, Rick Dwyer wrote: > Hello all. > > I perform a SQL query like the following: > > $sql = 'select * from my_table where id="10" > > It returns the the following array for 3 records: > > > Array ( [0] => Array ( [cb] => 2 ) [1] => Array ( [cb] => 6 ) [2] => Array ( >

[PHP] Selecting checkboxes based on SQL query

2012-02-23 Thread Rick Dwyer
Hello all. I perform a SQL query like the following: $sql = 'select * from my_table where id="10" It returns the the following array for 3 records: Array ( [0] => Array ( [cb] => 2 ) [1] => Array ( [cb] => 6 ) [2] => Array ( [cb] => 1 ) ) The values of CB in the above array are the values