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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T08:27:24+00:00 2026-05-31T08:27:24+00:00

I have 3 chain select boxes that return three values from the same line

  • 0

I have 3 chain select boxes that return three values from the same line of data in a table: $drop, $drop_2 and $drop_3, and I want to run a mysql query to return a value from another column from that line in the table. I can “echo” the value directly to the page, but I want to use the array value to then generate matching results from a different table in a “while” loop. I have the following set up, if anyone can tell me why it doesn’t work it would be highly appreciated!

<h1>Search Results</h1>

<table>
<tr>
<th>Name</th>
<th>Number</th>
<th>Description</th>
</tr>

<?php

$search_results = mysql_query("SELECT id_sensor FROM vehicles_new WHERE make='$drop' AND model='$drop_2' AND year='$drop_3'");

while($result = mysql_fetch_array($search_results)){        

    echo $result['id_sensor']; //This is displaying the value I need to use in the next query
    ?>

<?php

$sql = mysql_query("SELECT * FROM products WHERE id='$result'");

    while($row = mysql_fetch_assoc($sql)){
?>
    <tr>
    <td><?php echo $row['id']; ?></td>
    <td><?php echo $row['part_id']; ?></td>
    <td><?php echo $row['description']; ?></td>
    </tr>
<?php
    }
?>

    <?php
    }
?>
</table>

Thanks in advance, Joe

  • 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-31T08:27:26+00:00Added an answer on May 31, 2026 at 8:27 am

    change this

    $sql = mysql_query("SELECT * FROM products WHERE id='$result'");
    

    to this

    $sql = mysql_query("SELECT * FROM products WHERE id='" . $result['id_sensor'] . "'");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a chain of ajax requests that support a series of cascading drop
I have the following jQuery calls chain: $(someSelector).nextUntil(.specialClass).addClass(classBasedSomeSelectorObject) I need to addClass that's value
I have a few simple scripts that are intended to daisy chain together to
do routed events from wpf have something in common with the chain of responsibility
I have a table of items that need to be displayed in a certain
I have an AlumniRecords table with 60+ columns. I created an AlumniSearchResults class that
I'm trying to chain dropdown list events. I have these data: Name auidi (a4{
I have the following function that is extracting me distinct values based on the
I have this simple query SELECT EXISTS(SELECT a FROM A WHERE a = 'lorem
I have a view joining 3 tables together in a chain that i need

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.