Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Sponsored Links



Select to cascade ajax + mysql

Software Development


Reply
 
Thread Tools Search this Thread
  #1  
Old 28-01-2010
Member
 
Join Date: Jan 2010
Posts: 49
Select to cascade ajax + mysql
  

I must make a search engine with 6 multi select box. The choice of the 1st impact on the proposals available in the 2nd and the choice affects the proposals in the 3rd etc...

My problem is that I hope that by default the select box 6 offer all their options so that we can begin the selection cascading from any selection, not necessarily by the 1st.

Lets say that my request is to Get Help to enable all select to display all their options, not only for the 1st, as in the example.

In short how to cascade Ajax and MySql?

Reply With Quote
  #2  
Old 28-01-2010
Member
 
Join Date: Apr 2008
Posts: 2,001
Re: Select to cascade ajax + mysql

Quote:
enable all select to display all their options
during the initial generation of your page, simply supply the list with all possible values. That is, basically the same applications as those used in Ajax calls, but without the parameter retrieved from the list "before" (which restricts the choice of content already).

But, there you may need to pay more attention to chains if your lists were empty by default: if a choice from the list L1 brings nothing for posters to see in the list L2? When the lists are empty by default and they remain empty after this election, we doubt the significance. But if the following list were already completed and she is, how to deduce that the previous choice did not correspond to anything?
Reply With Quote
  #3  
Old 28-01-2010
Member
 
Join Date: Oct 2005
Posts: 2,389
Re: Select to cascade ajax + mysql

If your description is correct, it's just impossible. In any case, if you want to keep maintaining the rule "The choice of the 1st impact on the proposals available in the 2nd etc. ...". This is not a question of language but of logic.

Otherwise, effectively decoupling the lists and offer all the options from each list and then selecting an option from the list 1, change the items in the list 2 etc. ... Gasworks in perspective ..
Reply With Quote
  #4  
Old 28-01-2010
Member
 
Join Date: Apr 2008
Posts: 2,001
Re: Select to cascade ajax + mysql

Quote:
Originally Posted by Reegan View Post
If your description is correct, it's just impossible. In any case, if you want to keep maintaining the rule "The choice of the 1st impact on the proposals available in the 2nd etc. ...". This is not a question of language but of logic.

Otherwise, effectively decoupling the lists and offer all the options from each list and then selecting an option from the list 1, change the items in the list 2 etc. ... Gasworks in perspective ..
Why "Impossible"?

The rule is simply "Choosing from a list L affects the proposals available in the list L1 etc.."

Everything is managed correctly, if operationally feasible, the default values (mostly) ...

Whatever the number of lists, each of length than did the previous one (which serves as a filter) and next (on which she serves as a filter).
Reply With Quote
  #5  
Old 28-01-2010
Member
 
Join Date: Jan 2008
Posts: 1,515
Re: Select to cascade ajax + mysql

Example:
The database table we use in this example looks like this

[TABLE="3"]id FirstName LastName Age Hometown Job
1 Peter Griffin 41 Quahog Brewery
2 Lois Griffin 40 Newport Piano Teacher
3 Joseph Swanson 39 Quahog Police Officer
4 Glenn Quagmire 41 Quahog Pilot[/TABLE]

PHP code will be:
PHP Code:
<?php
$q
=$_GET["q"];

$con mysql_connect('localhost''peter''abc123');
if (!
$con)
  {
  die(
'Could not connect: ' mysql_error());
  }

mysql_select_db("ajax_demo"$con);

$sql="SELECT * FROM user WHERE id = '".$q."'";

$result mysql_query($sql);

echo 
"<table border='1'>
<tr>
<th>Firstname</th>
<th>Lastname</th>
<th>Age</th>
<th>Hometown</th>
<th>Job</th>
</tr>"
;

while(
$row mysql_fetch_array($result))
  {
  echo 
"<tr>";
  echo 
"<td>" $row['FirstName'] . "</td>";
  echo 
"<td>" $row['LastName'] . "</td>";
  echo 
"<td>" $row['Age'] . "</td>";
  echo 
"<td>" $row['Hometown'] . "</td>";
  echo 
"<td>" $row['Job'] . "</td>";
  echo 
"</tr>";
  }
echo 
"</table>";

mysql_close($con);
?>
Source: w3schools
Reply With Quote
  #6  
Old 25-10-2010
Member
 
Join Date: Oct 2010
Location: US
Posts: 1
Hello

Just thought I should take a moment and say what's up to everybody. Looking forward to the site and what everyone here has to talk about.
Reply With Quote
  #7  
Old 25-10-2010
Member
 
Join Date: May 2009
Posts: 1,611
Re: Select to cascade ajax + mysql

Welcome to Techarena forums friend.

Wish you great time here.
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Select to cascade ajax + mysql"
Thread Thread Starter Forum Replies Last Post
Using Ajax to Retrieve Data from a MySQL Database warthogweb Software Development 1 19-11-2010 10:46 PM
php/mysql select problem Fragman Software Development 3 30-11-2009 02:52 PM
Can a webpage fetch information from MySQL database using AJAX Technology? Chhaya786 Software Development 2 30-07-2009 10:03 PM
Mysql select from multiple tables for php. afidelino Software Development 4 09-07-2009 06:13 PM


All times are GMT +5.5. The time now is 03:17 AM.