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

  • Home
  • SEARCH
  • 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 7167567
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T14:36:09+00:00 2026-05-28T14:36:09+00:00

So first I do this: $zip_code_array = mysql_query(SELECT * FROM zip_code WHERE (lon BETWEEN

  • 0

So first I do this:

$zip_code_array = mysql_query("SELECT * FROM zip_code WHERE (lon BETWEEN '$lng_min_rnd'   AND '$lng_max_rnd') AND (lat BETWEEN '$lat_min_rnd' and '$lat_max_rnd')") or die (mysql_error());
while($zip_code_cells = mysql_fetch_array($zip_code_array))
{
$zip_codes_raw = $zip_code_cells['zip_code'];
$zip_codes_in_distance .= $zip_codes_raw.", ";
}

This works and spits out the zipcodes like this EX: 07110, 07111, 07112 etc:
But then I do this:

$user_list_array = mysql_query("SELECT * FROM member_search WHERE IN($zip_codes_in_distance) AND gender = '$gender_of_interest_session'");
while($user_list = mysql_fetch_array($user_list_array))
{
$id_from_array = $user_list['id'];
$username_from_array = $user_list['user_name'];
$defaultpic_from_array = $user_list['defaultpic'];
$city_from_array = $user_list['city'];

}

I get Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource on

$user_list_array = mysql_query("SELECT * FROM member_search WHERE IN($zip_codes_in_distance) AND gender = '$gender_of_interest_session'");

I can’t seem to figure out the proper way to query the list of zipcodes it comes out with. I do believe it has something to do with when I turn the zip code result into a string and have all of the zip codes seperated by a comma.

  • 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-28T14:36:10+00:00Added an answer on May 28, 2026 at 2:36 pm

    Your sql statement has errors. $zip_codes_in_distance has an ending , which is causing failure.

    It should be like this.

    $zips = array();
    $zip_code_array = mysql_query("SELECT * FROM zip_code WHERE (lon BETWEEN '$lng_min_rnd'   AND '$lng_max_rnd') AND (lat BETWEEN '$lat_min_rnd' and '$lat_max_rnd')") or die (mysql_error());
    while($zip_code_cells = mysql_fetch_array($zip_code_array))
    {
        $zip_codes_raw = $zip_code_cells['zip_code'];
        $zips[]= $zip_codes_raw;
    }
    
    $zip_codes_in_distance = "'". implode("','" , $zips). "'";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Code first: '''this is main structure of my program''' from twisted.web import http from
This is my first attempt with JQgrid and I am confused from the documentation
In linking a sports event to two teams, at first this seemed to make
This first bit works: $my_id = 617; $post_id_7 = get_post($my_id); $title = $post_id_7->post_excerpt; echo
(At first glance this may look like a duplicate of Different execution plan when
Saw this piece of code in a Ruby on Rails book. This first one
problem euler #5 i found the solution but i don't know why this first
Using Dozer to map two objects, I have: /** /* This first class uses
#include <iostream> using namespace std; // This first class contains a vector and a
First check out this code. I seems like it should work for me, but

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.