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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T06:00:42+00:00 2026-06-04T06:00:42+00:00

I have an array of data that generates unique data on the fly in

  • 0

I have an array of data that generates unique data on the fly in a manor of speaking. It’s actually an array with 5 hashes.

What I want to do is a basic select query with a where clause that checks each via OR basically a one line query rather than a query for each array item.

I’m attempting to ensure that no one hash that enters the db is the same as another which I know the probability is virtually null to that actually happening but it’s a possibility none the less, safer than sorry is my perspective on the matter

Anyway the query I’m thinking of makes no sense as if a match is found the query will result in such what I wanna do is from the original array find the one that’s not found and use it where if all 5 aren’t found I’ll just randomly pick one I guess in the end I want to form a result that is 1 to 5 in a new array so I can randomly pick from that result

Is this possible or would it just be easie to cycle over each one with a songle query?

  • 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-04T06:00:43+00:00Added an answer on June 4, 2026 at 6:00 am
    "SELECT
            CASE hashes.hash
                WHEN $hashes[0] THEN 0
                WHEN $hashes[1] THEN 1
                WHEN $hashes[2] THEN 2
                WHEN $hashes[3] THEN 3
                ...
            END
        FROM hashes WHERE hashes.hash IN(".implode($hashes).")"
    

    This should tell you exactly which of the hashes you sent to the server have been found on the server.

    The result set would be the index keys (0, 1, 2, 3) of the array that generated the query.

    If you sent a query based on an array of 100 hashes and you get a result set of 99 hashes, that means at least one hash was not found in the db.

    You could cycle through the result set like this:

    while($row = $pdo->fetch()) {
        $index = $row[0]  // first column of the result set
       unset($hashes[$index]);
    }
    

    When while finishes the only hashes left in the array should be the ones that weren’t found in the database.

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

Sidebar

Related Questions

I have a function that generates a dropdown based on a query or array
I have some python code which generates a 256^3 numpy array of data that
I have a php array that has a bunch of data that I need
I have a model that I'm trying to retrieve an array of data from,
I have an accordion that binds data for each item from an array. I
I have a variable that contains an array from form data, seen below: $option1
I have inherited an app that generates a large array for every user that
I have an application that generates an array of statistics based on a greyhounds
I have three dimensional array of data that is generated from web server logs
I have an array of data that has been collected by iterating through an

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.