Jump to content

Dynamically printing Mysql query results.. HELP!!!


Matt G

Recommended Posts

Hello everyone,

I have dynamically created a  series of radio buttons, with "Options" populated from mysql:

 

e.g.

 

"Option 1"

radio button 1 (OK)

radio button 2 (Maybe)

radio button 3 (Eliminate)

 

"Option 2"

radio button 1 (OK)

radio button 2 (Maybe)

radio button 3 (Eliminate)

 

Etc...

 

I have created a javascript  loop (to loop through the form)...

I have also created a script and table to display the results dynamically..

However, I am having trouble querying the sql database to display the proper results..

 

HERE'S WHAT I NEED:

 

When radio button 1 is selected, I need the query to grab the selected "Option" to be displayed/printed.

 

When radio button 2 is selected, I need the query to grab the selected "option" and isolate it to be displayed/printed in a separate area(of the results page)

 

But when radio 3 is selected, I need the query to not grab this "option".. This "option" should be hidden from the user on the results page!

 

Im sure there must be a million ways to do this, but I cant find any articles that seem to help.. or maybe Im looking in the wrong place??! Please Help I would greatly appreciate it!!

 

Sorry if this seems confusing and Thanks in advanced!!!

Link to comment
Share on other sites

i can also send snippets of the code I have created if it helps!!

 

//code

 

$filterQuery = "SELECT *

FROM table_2

INNER JOIN table_1 ON table_2.Option_Id=table_1.Option_Id where ";

 

$list = split($filterList,",");

 

$first = false;

 

foreach( $list as $filter ) {

if( $first ) { $filterQuery .= " WHERE AND ";  }

 

$filterQuery .= "table_1.Option_Category <> '" . $filter . "' AND table_1.Option_Type <> '" . $filter . "'";

$first = true;

}

 

$filterQuery .= ";";

 

 

$filterResults= mysql_query($filterQuery);

 

 

$filter_row= mysql_fetch_assoc($filterResults);

 

//code

 

Im joining two tables on the same column and wish t eliminate the option category and or type IF third radio button is selected..

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.