473,786 Members | 2,574 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Select-Abfrage nach dropdown-Vorgabe abändern!?

Hi,

i save junior football results in a mysql table
(FIELDS id jugend autor sptag ergebnis spdatum zeit )

With the following lines I generate a site whichs gives me ALL results

Code:
<table border="0" cellspacing="1" cellpadding="2" class="content"
width="100%">
<?
$sqlbefehl= "Select *
From $jugendtab b
Left Outer Join $tab_user u on u.id=b.autor
Order By b.jugend ASC Limit $eintrag,$zps";
$ergebnis = mysql_query($sq lbefehl, $serverid);
while ( $spiel = mysql_fetch_arr ay ($ergebnis)) {
echo "<tr>";
//Jugendmannschaf t
echo "<td align=\"center\ " class=\"left\" bgcolor=\"$c_ri ght\">";
echo $spiel['jugend'];
echo "</td>";
//Spieltag
echo "<td align=\"center\ " class=\"right\" bgcolor=\"$c_ri ght\">";
echo $spiel['sptag'];
echo "</td>";
//Datum ###########:
echo "<td align=\"center\ " class=\"left\" bgcolor=\"$c_le ft\"><font
size=\"1\"><nob r>";
echo date("d.m.Y",$s piel[spdatum]+$time_offset);
echo "</nobr></td></tr>";
?>
</table>
Now I want make dropdown menu above which has all junior teams inside
(junior teams token comes from the mysql field "jugend" and is e.g. A,
B, etc.).

When a user selects e.g. "B" from this dropdown only the lines which
has "B" in the "jugend"-field should be displayed.

How can I do that?

Thanks

Regards,
Jagg
Jul 17 '05 #1
3 2290
jagg wrote:

How can I do that?


To let you know your title was German...

--
Google Blogoscoped
http://blog.outer-court.com
Jul 17 '05 #2
jagg wrote:
With the following lines I generate a site whichs gives me ALL results

Code:
<table border="0" cellspacing="1" cellpadding="2" class="content"
width="100%">
<?
$sqlbefehl= "Select *
From $jugendtab b
Left Outer Join $tab_user u on u.id=b.autor
Order By b.jugend ASC Limit $eintrag,$zps";
$ergebnis = mysql_query($sq lbefehl, $serverid);
while ( $spiel = mysql_fetch_arr ay ($ergebnis)) {
echo "<tr>";
//Jugendmannschaf t
echo "<td align=\"center\ " class=\"left\" bgcolor=\"$c_ri ght\">";
echo $spiel['jugend'];
echo "</td>";
//Spieltag
echo "<td align=\"center\ " class=\"right\" bgcolor=\"$c_ri ght\">";
echo $spiel['sptag'];
echo "</td>";
//Datum ###########:
echo "<td align=\"center\ " class=\"left\" bgcolor=\"$c_le ft\"><font
size=\"1\"><nob r>";
echo date("d.m.Y",$s piel[spdatum]+$time_offset);
echo "</nobr></td></tr>";
?>
</table>

Now I want make dropdown menu above which has all junior teams inside
(junior teams token comes from the mysql field "jugend" and is e.g. A,
B, etc.).

When a user selects e.g. "B" from this dropdown only the lines which
has "B" in the "jugend"-field should be displayed.

How can I do that?


Add a form on the page:

<form>
<select name="opt">
<option value="A">A</option>
<option value="B">B</option>
<option value="C">C</option>
</select>
<input type="submit" value="View">
</form>

Then in the code, change to something like this:

if(isset($_GET['opt'])){
$sqlbefehl= "Select *
From $jugendtab b
Left Outer Join $tab_user u on u.id=b.autor
Where b.jugend = '{$_GET['opt']}' Limit $eintrag,$zps";
}else{
$sqlbefehl= "Select *
From $jugendtab b
Left Outer Join $tab_user u on u.id=b.autor
Order By b.jugend ASC Limit $eintrag,$zps";
}

HTH

--
Justin Koivisto - sp**@koivi.com
PHP POSTERS: Please use comp.lang.php for PHP related questions,
alt.php* groups are not recommended.
Jul 17 '05 #3
Justin Koivisto <sp**@koivi.com > wrote in message news:<xd******* ***********@new s7.onvoy.net>.. .
Add a form on the page:

<form>
<select name="opt">
<option value="A">A</option>
<option value="B">B</option>
<option value="C">C</option>
</select>
<input type="submit" value="View">
</form>

Then in the code, change to something like this:

if(isset($_GET['opt'])){
$sqlbefehl= "Select *
From $jugendtab b
Left Outer Join $tab_user u on u.id=b.autor
Where b.jugend = '{$_GET['opt']}' Limit $eintrag,$zps";
}else{
$sqlbefehl= "Select *
From $jugendtab b
Left Outer Join $tab_user u on u.id=b.autor
Order By b.jugend ASC Limit $eintrag,$zps";
}

HTH


THANKS YOU VERY MUCH!!!!

It works!

Jagg
Jul 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
6951
by: Elroyskimms | last post by:
Using SQL 2000... tblCustomer: CustomerID int CompanyName varchar(20) HasRetailStores bit HasWholesaleStores bit HasOtherStores bit tblInvoiceMessages:
4
7404
by: bobsawyer | last post by:
I've been building a series of SELECT lists that are populated dynamically using HTTPRequest. Things are going pretty well, and I've got the whole thing working flawlessly in Mozilla/Firebird. Unfortunately, Internet Explorer doesn't quite work as expected -- it gives me an "invalid argument" error that I don't know how to fix. Here's the entire script, with form, annotated to explain what I'm doing and where the problem is occurring. I...
3
5730
by: dumbledad | last post by:
Hi All, I'm confused by how to replace a SELECT statement in a SQL statement with a specific value. The table I'm working on is a list of words (a column called "word") with an index int pointing to the sentence they come from (a column called "regret"). I also have a table of stop words (called "GenericStopWords") that contains the words I do not want to consider. That table has a single column called "word". I started off using a...
10
5639
by: serge | last post by:
Using "SELECT * " is a bad practice even when using a VIEW instead of a table? I have some stored procedures that are identical with the difference of one statement in the WHERE clause. If I create a single View and specify also in this View the WHERE clause that is common in these stored procedures, I will have the new stored procecures changed to be like:
1
2970
by: serena.delossantos | last post by:
Trying to insert into a history table. Some columns will come from parameters sent to the store procedure. Other columns will be filled with a separate select statement. I've tried storing the select return in a cursor, tried setting the values for each field with a separate select. Think I've just got the syntax wrong. Here's one of my attempts: use ESBAOffsets go
9
51989
chunk1978
by: chunk1978 | last post by:
hey everyone, i've been trying to solve this problem for 2 days straight, with no end in sight. i would greatly appreciate anyone's help. EXPLANATION: There are 3 Select Menus. The 1st and 2nd Select Menu are "printing options" for 4x6 and 5x7 prints respectively. the 3rd Select Menu holds an "Email" option that can be toggled (appear/reappear) by the 1st and 2nd Select Menus. So if a user selects prints from either 4x6 or 5x7 menu,...
2
3928
by: naima.mans | last post by:
Hello, i want to select 2 following brothers nodes wich are one under another (one closed to another)... i have done one xslt file... but it's not really good.. for example: the xml file: ----------------------------------------------------- <loanService>
4
4400
by: rn5a | last post by:
A Form has 2 select lists. The 1st one whose size is 5 (meaning 5 options are shown at any given time) allows multiple selection whereas the 2nd one allows only 1 option to be selected at a time. When an option is selected in the 2nd select list, the ASP page posts itself. Assume that the 1st select list has the following 10 options (note that both the select lists are actually populated from 2 different database tables): Australia
2
2193
by: artev | last post by:
if I insert a string null in a select, it change position; why? I insert value "" in 2nd 3th select; <style type="text/css"> td {border:2px solid pink;}; </style>
6
3395
by: Apaxe | last post by:
In the database i have a table with this information: key_id =1 key_desc =43+34+22+12 I want sum the values in key_desc. Something like: SELECT key_desc FROM table But the result of the select was "111" and not "43+34+22+12".
0
10363
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10164
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10110
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9962
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8992
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7515
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5534
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4067
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3670
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.