Jeg har et søgescript som jeg har rettet lidt til efterhånden, og nu
er jeg nået dertil hvor det skal udvides en del, men også hvor jeg
står af...
Jeg har oprettet 6 felter som søgekritier, men jeg ved ikke helt
hvordan man skal sætte min query sammen. Her er lidt af min kode...
<FORM ACTION="vis.php" METHOD="post">
<table width=90% border=0>
<tr>
<td width=30%><CENTER>
Mærke:
</td>
<td width=30%><CENTER>
Model:
</td>
<td width=30%><CENTER>
Årgang:
</td>
</tr>
<tr>
<td width=30%><CENTER>
<select name="marke" CLASS="felter">
<option value="tom" selected>
<option value="Aprilia">Aprilia
<option value="Benelli">Benelli
<option value="Bmw">BMW
<option value="Ducati">Ducati
<option value="Honda">Honda
<option value="Jawa">Jawa
<option value="Kawasaki">Kawasaki
<option value="Moto Guzzi">Moto Guzzi
<option value="Suzuki">Suzuki
<option value="Triumph">Triumph
<option value="Yamaha">Yamaha
</select>
</td>
<td width=30%><CENTER>
<INPUT NAME="model" TYPE="text" SIZE="20" Class="felter">
</td>
<td width=30%><CENTER>
<select name="aargang" CLASS="felter">
<option value="" selected>
<option value="1981">1981
<option value="1982">1982
<option value="1983">1983
<option value="1984">1984
<option value="1985">1985
<option value="1986">1986
<option value="1987">1987
<option value="1988">1988
<option value="1989">1989
<option value="1990">1990
<option value="1991">1991
<option value="1992">1992
<option value="1993">1993
<option value="1994">1994
<option value="1995">1995
<option value="1996">1996
<option value="1997">1997
<option value="1998">1998
<option value="1999">1999
<option value="2000">2000
<option value="2001">2001
</select>
</td>
</tr>
<tr>
<td width=30%><CENTER>
CCM:
</td>
<td width=30%><CENTER>
Pris:
</td>
<td width=30%><CENTER>
Med/Uden Afgift:
</td>
</tr>
<tr>
<td width=30%><CENTER>
<select name="ccm" CLASS="felter">
<option value="" selected>
<option value="125">125
<option value="250">250
<option value="400">400
<option value="500">500
<option value="600">600
<option value="750">750
<option value="900">900
<option value="1000">1000
<option value="1100">1100
<option value="1200">1200
<option value="1300">1300
</select>
</td>
<td width=30%><CENTER>
<select name="pris" CLASS="felter">
<option value="" selected>
<option value="">0-10.000
<option value="1982">10.001-20.000
<option value="1983">20.001-30.000
<option value="1984">30.001-40.000
<option value="1985">40.001-50.000
<option value="1986">50.001-60.000
<option value="1987">60.001-70.000
<option value="1988">70.001-80.000
<option value="1989">80.001-90.000
<option value="1990">90.001-100.000
<option value="1991">100.001-110.000
<option value="1992">110.001-120.000
<option value="1993">120.001-130.000
<option value="1994">130.001-150.000
<option value="1995">150.001-175.000
<option value="1996">175.001-200.000
<option value="1997">200.000-?
</select>
</td>
<td width=30%><CENTER>
<select name="afgift" CLASS="felter">
<option value="Med">Med
<option value="Uden">Uden
</select>
</td>
</tr>
</table><br>
<center><INPUT NAME="sog" TYPE="submit" VALUE="Søg"
Class="felter">
</FORM>
</CENTER><P>
<?
}
?>
<?
if ((@$sog) || (@$nr)){
// tilslut databasen
mysql_connect("localhost","test","test");
mysql_select_db("db1") or die("Error opening database ..");
// find alle records fra databasen ..
$query = "select id, marke, model, ccm, aargang, km, pris FROM
annoncer WHERE NOW() <= DATE_ADD(date, INTERVAL 60 DAY) ORDER BY
marke,model,ccm,pris";
if (@$nr) $query = "select * from annoncer where (id = $nr)
order by id";
if (@$ord) $query = "select * from annoncer where ($felt LIKE
'%$ord%') order by id";
$result = mysql_query($query);
Håber der er nogen der vil hjælpe mig ?
|