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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T23:48:47+00:00 2026-05-26T23:48:47+00:00

Please forgive me if this is a dumb question. I’m only a week into

  • 0

Please forgive me if this is a dumb question. I’m only a week into programming…

I’m getting my fetch error “or die” statement triggered on line 87 (at least in my editor it is 87, not sure how it will show up here). The strange thing is that it still works. The variables on the next two lines are being set and echoed correctly. Any ideas on why this is occurring would be appreciated. Thanks.

<?php
include 'header.php';

//$results_per_page=10;
//$count_results=mysql_query("SELECT COUNT('zipcodes') FROM jobposts");
//$page_results=$count_results;
//echo $count_results;

//if ($count_results%$results_per_page!=0)
//{
//$page_results+=1;
//}


 /////// zip code search setup ///////////
 $homezip=22102;
 $radius=10;
 $id=1;

$query="select longitude,latitude from zipcodes where zipcode='$homezip'";
$run_query=mysql_query($query) or die ("run query error");
$findzip2=mysql_fetch_array($run_query) or die ("test");
$homelong=$findzip2['longitude'] or die ("array error");
$homelat=$findzip2['latitude'] or die ("array error");


function calcDist($lat_A, $long_A, $lat_B, $long_B) {

 $distance = sin(deg2rad($lat_A))
            * sin(deg2rad($lat_B))
            + cos(deg2rad($lat_A))
            * cos(deg2rad($lat_B))
            * cos(deg2rad($long_A - $long_B));

 $distance = (rad2deg(acos($distance))) * 69.09;

  return $distance;
  }
 //////// end zip code search setup ////////////////



 echo "<table border='1'>";

  if (isset($_POST['search']))
 {
  $keywords=$_POST['keywords'];
  $zipcode=$_POST['zipcode'];

  if ($zipcode=="")
  {
   ($zipcode_search="");
  }

   else
  {
   ($zipcode_search=" and zipcode='$zipcode'");
   }

   if (!(isset($_POST['hidden'])))
    {
    $search = "select * from jobposts where description LIKE '%$keywords%'            $zipcode_search";
    $run_search=mysql_query($search) or die ("cannot run search");


    //$zip_array=$main_array[''];
    //echo count($zip_array)."<br>";
    //echo $zip_array['zipcode'];


 ////store results in array
  ////pull zip codes out of array one at a time
  ////put the zip codes in the radius function - if statement
  ////if less than allowable radius - publish results

  $count=0;
    if (mysql_num_rows($run_search)>=1)
        {
        while ($query_rows=mysql_fetch_assoc($run_search))
            {
            $zip_array[$count]=($query_rows['zipcode']);

            $zip_to_test=$zip_array[$count];

            $testquery="select longitude,latitude from zipcodes where zipcode='$zip_to_test'";
            $testrun_query=mysql_query($testquery) or die ("run query error");
            $testfindzip2=mysql_fetch_assoc ($testrun_query) or die ("fetch error - testfindzip2");
            $testlong=$testfindzip2['longitude'] or die ("array error");
            $testlat=$testfindzip2['latitude'] or die ("array error");
            $count++;
            echo $testlong."<br>";
            if (calcDist($homelat,$homelong,$testlat,$testlong)<$radius)
            {
            echo "<tr><td>".$query_rows['company']."</td><td>".$query_rows['zipcode']."</td></tr>";
            }
            }
        }
        else
        {
        echo "No results found.";
        }
    }
    else
        {
        echo "Please submit search data before submitting.";
        }


    }
   else

   {
   echo "Failed to submit search request.";
  }



  ?>
  • 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-26T23:48:48+00:00Added an answer on May 26, 2026 at 11:48 pm

    mysql functions only return false, which would trigger your die(), if something went wrong with the query: syntax error, not connection, permission denied, etc…

    A query which returns no results is NOT an error condition, and will not trigger the or die(). An empty result set is a perfectly valid result set.

    As well,

    $var = $othervar or die();
    

    makes no sense whatsoever, as an assignment will always succeed (unless you run out of memory or something).

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

Sidebar

Related Questions

I'm new to programming so please forgive me if this is a dumb question...
Please try to forgive this slightly off-programming-topic question. At least I'm getting this problem
I am very new to programming, so please forgive me if this question seems
I'm new to programming so please forgive me if this is a noob question!
Please forgive me if this question is ridiculous. I'm relatively new to programming and
Please forgive my programming knowledge. I know this is a simple thing, but I
Please forgive if this question has been asked numerous times. I recently installed Eclipse
please forgive me if this is a noob question, but i'm a beginner at
This is my first post, so please forgive me if this question has been
Please forgive me up front. When I've tried to research this question I end

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.