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 7650395
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T11:14:31+00:00 2026-05-31T11:14:31+00:00

EDIT: $query->where(‘`value` = ?’, $number); It seems that does the job. I still don’t

  • 0

EDIT:

$query->where(‘`value` = ?’, $number);
It seems that does the job. I still don’t know why it won’t work under normal conditions, but it’s a work around.. still looking for the right answer!


I’m trying to query a DB with a simple:

$number = 4;
$query = $this->select();
$query->where('value = ?', $number);
$row = $this->fetchRow($query);

But for some reason I constantly got this error:

SQLSTATE[42000]: Syntax error or access violation: 1064 You have an
error in your SQL syntax; check the manual that corresponds to your
MySQL server version for the right syntax to use near ‘value = 4)
LIMIT 1’ at line 1

When I do my assemble to see the query string:

SELECT `mighty_table`.* FROM `mighty_table` WHERE (value = 4)

My column name its not escaped..

Should Zend DB do that? 😐 It’s strange since i use this same method in other projects and it always works..

  • 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-31T11:14:33+00:00Added an answer on May 31, 2026 at 11:14 am

    “value” is indeed a reserved word in MySQL. As a result you need to escape it using back ticks.

    I would expect this to work:

    $fieldName = $this->getAdapter()->quoteIdentifier('value');
    $query->where($fieldName = ?", $number);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to edit this query =COUNTIFS('Sheet1'!E2:E465,7,'Sheet1'!F2:F465,2) so that when I drag/copy it sideways,
Is it possible to turn off the query re-formatting that happens when you edit
I run script/generate model query edit query.rb in models.. class Query < ActiveRecord::Base #I
Would you recommend me the best approach to edit SQL query with Visual Studio
[ edit ] For the record, here's the problem portion of the query, which
Edit: From another question I provided an answer that has links to a lot
EDIT: Learned that Webmethods actually uses NLST, not LIST, if that matters Our business
I'm looking at an execution plan from a troublesome query. I can see that
Need help with a wordpress problem. I need to edit the query.php to ONLY
This is a query that totals up every players game results from a game

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.