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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T10:11:41+00:00 2026-06-13T10:11:41+00:00

I try to query in my script my database. The query’s parameters depends on

  • 0

I try to query in my script my database. The query’s parameters depends on what I have defined in my GUI. Sometimes I like to use the NAME in query and sometimes the CITY. Here is the code:

  var query = 'STRUCTTYPE: PERSON';

  if (value1 != 0) {
    query = query + ', NAME: ' + value1;
  }
  if (value2 != 0) {
    query = query + ', CITY: ' + value2;
  }

So the string ‘query’ itself is ok, but when I try to use it in db.query I get error message.

var results = db.query(query);

Any suggestions? Or other ways to handle this problem? Thanks!

  • 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-06-13T10:11:43+00:00Added an answer on June 13, 2026 at 10:11 am

    The query parameter you pass to ScriptDb.query function must be an object, not a string. Try this:

    var query = {STRUCTTYPE: 'PERSON'};
    if( value1 != 0 ) //this != 0 seems a weird test, but I'm copying from your example
      query.NAME = value1;
    if( value2 != 0 )
      query.CITY = value2;
    
    var results = db.query(query);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to use Subsonic 3.0 but with every query I try it gives
I have this script which uses PHP PDO to access the MySQL database, but
I'm writing a python CGI script that will query a MySQL database. I'm using
I have a long running PHP script. I am making the database connection at
In the database I have a string like this: Caisse primaire d'assurance maladie Now
I have a php script below where it adds a database row if a
I currently have a script written in PHP where I connect to a database
Ok, so I have the following script that will export data from my database
I have created this php script, to create an xml-file from my database: <?php
I'm taking a database class and I'd like to have a large sample database

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.