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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T12:07:06+00:00 2026-06-09T12:07:06+00:00

I have a PHP page with 3 dropdownlists on it. Everytime with an ‘onchange’

  • 0

I have a PHP page with 3 dropdownlists on it. Everytime with an ‘onchange’ event a javascript docs get’s the selected value’s and transfers it to a php function, where I can transfer them to my mysql-database and get results out of them. This thing works perfect, but not when I apply my logic to define which function I should call

My php page contains the effective logic (see code-box) and underneed there are the 2functions with the actions. The function do work, but the problem is this. There’s the possibility in the if-else construction that the functions can be called on 2 different moments. The first time in the if-else construction both of the calls are succesfull and the result is what it should be, the second moments it seems that the $result parameter is empty?

$result = mysql_query($sql) or die("Query failed with error: ".mysql_error());

$aantal = mysql_num_rows($result);
if($amount == 0){


echo "<p>This combination does not exist</p>";
    }
    else {
        // lists are empty
        if($soort == 'Empty' && $land == 'Empty' && $jaar == 'Empty'){
        }
        else {
            if ($aantal > 2){
                maketable($aantal, $result); // -> **succesfull call**
            }
            else if($aantal == 1){
                makedetails($result); // -> **succesfull call**
            }
            else {
                $first = mysql_result($result, 0);
                $second = mysql_result($result, 1);
                if (($second - $first) == 1){
                    makedetails($result); //  -> **does not work**
                }
                else {
                    maketable($aantal, $result); //  -> **does not work**
                }
            }
        }
    }

function maketable($aantal, $result) { … }
function makedetails($result){ … }

greetings

  • 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-09T12:07:08+00:00Added an answer on June 9, 2026 at 12:07 pm

    Had to fetch my result once more to make it possible to loop through my array once again.

    $first = mysql_result($result, 0);
    $second = mysql_result($result, 1);
    $result = mysql_query($sql) or die("Query failed with error: ".mysql_error());
    

    But thanks for the help!

    greetings

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

Sidebar

Related Questions

I have a php page. It recieves a value for id via get. 2
I have a php page and i have some javascript code to have a
I have a php page with the follow javascript code in it: $(#saveButton).click(function() {
I have one php page like this <script type=text/javascript src=js/jquery.min.js></script> <script type=text/javascript> window.onbeforeunload =
ok assume i have php page has this name name.php?get= and has get varible
I have a PHP page that I'm using JavaScript with to update dropdown lists
I have a PHP page where i want to open a file on a
I have a PHP page that loads external content using other PHP files. I'm
i have a php page that redirects (if successful) to another php page like
I have this PHP page where the user can select and un-select items. The

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.