Note that there are some explanatory texts on larger screens.

plurals
  1. POupdating multiple value of one column of table in zend framework
    primarykey
    data
    text
    <p>i have an an array</p> <pre><code>$array_to_pass; //this array is created dynamically looks like this Array ( [cal] =&gt; 1 [sms] =&gt; 1 [contacts] =&gt; 0 [browsing] =&gt; 1 [history] =&gt; 0 [photo] =&gt; 0 ) </code></pre> <p>now i want to update table with name "my_table".in my_table there are column with name "flags" and "value_of_flags "<strong>under column 'flags' there are many flags</strong> but i want to <strong>UPDATE</strong> Only these.i mean cal,sms,contacts,browsing,history,photo in the above array lets say <code>[cal] =&gt; 1</code> so 'cal' is the name of the flag and i want to set value of 1 or 0 to 'value_of_flags' column, the WHERE CLAUSE ll be "where id = $var" how would i write this query ???</p> <p>my table looks like this </p> <pre><code> flags value_of_flags id a 1 555 b 0 456 call 0 236 sms 1 122 e 1 456 contacts 0 777 g 0 555 browsing 0 888 i 1 112 photo . . . . . . . . </code></pre> <p><strong>EDITED</strong></p> <pre><code>function Save_User_Prefrences($array_to_pass,$phone_service_id){ $DB = Zend_Db_Table_Abstract::getDefaultAdapter(); //$whereStr = "phone_service_id = " . (int)$phone_service_id; foreach ($array_to_pass as $key =&gt; $value) { $DB-&gt;update('user_preferences', array( $key =&gt; $value ), "phone_service_id = " . $phone_service_id ); } </code></pre> <p><strong>error</strong></p> <pre><code>&lt;b&gt;Fatal error&lt;/b&gt;: Uncaught exception 'PDOException' with message 'SQLSTATE[42S22]: Column not found: 1054 Unknown column 'call' in 'field list in pdo.php </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload