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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T18:08:01+00:00 2026-06-04T18:08:01+00:00

I need to pass an array of strings in a parameterized query. I tried

  • 0

I need to pass an array of strings in a parameterized query. I tried the following but it doesn’t work at all.

$params = array( array('bob','andrew','larry') );
pg_query_params($conn, 'SELECT * FROM table1 WHERE field = ANY($1)', $params)

I’ve seen solutions that converts the array to a string and then uses string_to_array to convert the input to an array on the database side, but as those strings are input from users this could end badly, even if I used a delimiter other than a comma. I’d rather use a cleaner solution for this, if possible.

Is there a way to keep this query parameterized and pass an array to it, without resorting to converting the data to a string?

By the way, I’m using PostgreSQL 8.3

  • 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-04T18:08:03+00:00Added an answer on June 4, 2026 at 6:08 pm

    pgsql.so is linked to libpq which does not have this capability.

    Internally, it would need to serialize an array into string anyway.

    libpqtypes has this capability built in, but I’m now aware of any PHP libraries using it.

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

Sidebar

Related Questions

I need to pass an array of strings as parameter to a MySQL stored
I need to pass an array of strings to SQL Server 2005, and so
So I need to pass to a JavaScript function an array of strings in
I need to pass an array of strings from the backing bean to the
I have an application in which I need to pass an array from C#
Possible Duplicate: when do we need to pass the size of array as a
I need to pass the $route to its inner function,but failed: function compilePath( $route
I need to pass a variable number of strings to instantiate different classes. I
I have this simple function which I pass in an array of strings: function
i have the following problems in C programming. I have an array of strings

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.