guten morgen
Also folgendes problem
Ich habe mir ein such funktion gebastellt leider geht sie nicht.
Vieleicht entdeck ihr mein fehler.
db sieht folgendermaßen aus
Tabelle mlsp
id
idcustomer
customergid
mlsp
Tabelle customer
id
idcustomer
company
firstname
lastnamm
u.s.w.
Tabelle customerg
id
customergid
company
firstname
lastnamm
u.s.w.
mein formular sieht so aus.
HTML-Code:
<form action="'.$_SERVER["PHP_SELF"].'?action=searcha" method="post">
<td width="410" height="328" valign="top"class="inhalt" align="center">
<input type="radio" class="rad"value="mlps" name="kat"checked="checked"/>MLSP
<input type="radio" class="rad"value="mlspln" name="kat" />MLSP/ListingID
<br />
<input type="radio"class="rad" value="company" name="kat" />Company <input type="radio" class="rad"value="city" name="kat" />City <input type="radio" class="rad"value="country" name="kat" />Country</td>
</from>
PHP-Code:
if(isset($_POST['submit']))
{
if (!empty($_POST['searcha']))
{
if($_POST['kat']=='mlsp')
$spalte=mlsp;
else
if($_POST['kat']=='mlspln')
$spalte=mlspln;
else
if($_POST['kat']=='company')
$spalte=company;
else
if($_POST['kat']=='city')
$spalte=city;
else
$spalte=country;
// eine verkürzteschreibweise
//$spalte=$_POST['kat']=='mlsp'?'mlsp':$_POST['kat']=='mlspln'?'mlspln': //$_POST['kat']=='company'?'company':($_POST['kat']=='city'?'city':"country");
$ergebnis= "Select * from `mlsp` INNER JOIN `customerg` INNER JOIN `customer` ON `mlsp`.`idcustomer` = `customer`.`customerid` INNER JOIN `mlsp`.`customergid` = `customerg`.`customergid` WHERE ".$spalte." LIKE '%".$_POST['searcha']."%'";
$sql = mysql_query($ergebnis) or die(mysql_error());
viele dank für eure hilfe