Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1097921
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T00:30:12+00:00 2026-05-17T00:30:12+00:00

To use where in a MySQL table row update in Zend Framework I have

  • 0

To use where in a MySQL table row update in Zend Framework I have something like:

public function updateBySiteId(array $data, $id) {
        $table = $this->gettable();

        $where = $table->getAdapter()->quoteInto('site_id = ?', $id);

        return $table->update($data, $where);
    }

and this, I expect, gives me something like…

UPDATE foo SET ponies = 'sparkly' WHERE site_id = '1'

But what if I want to create the following:

UPDATE foo SET ponies = 'sparkly' WHERE site_id = '1' AND type = 'zombie'

In the manual I don’t see how to do this with quoteInto (or quote or some other safe method… which could just mean I’m looking in the wrong place but… sigh).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T00:30:12+00:00Added an answer on May 17, 2026 at 12:30 am

    Since the table update() method
    proxies to the database adapter
    update() method, the second argument
    can be an array of SQL expressions.
    The expressions are combined as
    Boolean terms using an AND operator.

    http://framework.zend.com/manual/en/zend.db.table.html

    $data = array(
    'updated_on'      => '2007-03-23',
    'bug_status'      => 'FIXED'
    );
    $where[] = "reported_by = 'goofy'";
    $where[] = "bug_status = 'OPEN'";
    $n = $db->update('bugs', $data, $where);
    

    Resulting SQL is:

    UPDATE "bugs" SET "update_on" = '2007-03-23', "bug_status" = 'FIXED' WHERE ("reported_by" = 'goofy') AND ("bug_status" = 'OPEN')
    

    http://framework.zend.com/manual/en/zend.db.adapter.html#zend.db.adapter.write.update

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a remote mySQL table that I use in a few tools, occasionally
table : id (integer primary key) data (blob) I use mysql and sqlalchemy. To
I got a table like this, and use MYSQL 5.5 id --- 2 3
I use php to display a table of data drawn from my mysql database.
I have a mysql table like this (sql): CREATE TABLE IF NOT EXISTS silver_and_pgm
Hi I have senario where i need to update the MySQL table which has
I have mysql error with code 1451. Cannot delete or update a parent row:
I have a table in my database : And I'm using MySQL to insert/update/create
I have a MySQL table that looks like this: Table: Designer id: integer name:
Everytime I use MySQL's CREATE TABLE AS SELECT ... all the tables/indexes being selected

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.