Klucyder: SQL-Tabellen in PHP verknüpfen!

Beitrag lesen

Mist geht nicht.. ich poste dir mal mein Quelltext vielleicht hab ich da was vergessen!

<?php
include('include/logincheck.inc.php');
?>
<html>
<head>
<style type="text/css">
#p1 { padding-left: 5px;}
</style>
<title>Deutsche Telekom - Intranet</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<LINK href="css/ie.css" rel=stylesheet>

<body bgcolor="#FFFFFF" text="#000000" topmargin="0" leftmargin="0" bottommargin="0" rightmargin="0" marginheight="0" marginwidth="0">
<a name="topofpage"></a>

<!--abstand 30x-->

<table border="0" cellspacing="0" cellpadding="0">
 <tr>
<!-- Abstand LinkerRand -->

<td><IMG SRC="images/0.gif" WIDTH="10" HEIGHT="1" BORDER="0"></td>
<!-- /Abstand LinkerRand -->

<!-- CONTENT BEREICH -->
  <td>
<!-- BREADCRUMB -->
   <table border="0" cellspacing="0" cellpadding="0" width="590" dwcopytype="CopyTableCell">
        <tr>
          <td height="18" valign="bottom" width="100%"><font class="breadcrumbactive"><a href="index.htm" class="breadcrumb" target="_top">Startseite</a>
           <font class="breadcrumbpfeil">></font> Buch suchen</font></td>
        </tr>
      </table>

<img SRC="images/0.gif" width="1" height="10"><br>
<!-- /BREADCRUMB -->

<!--Titel-->
   <font class="titleone">Suchen nach Datensätzen.</font><br>
   <font class="titletwo">Bücher.</font><br>
      <!--/Titel-->
      <img SRC="images/0.gif" width="1" height="12"><br>
      <table border="0" cellspacing="0" cellpadding="0" width="800">
        <tr>
          <td width="800"  class="fliesstext" valign="top" colspan="3">
<?php
if (@$_POST['gesendet'])
{
   @$suchstring = $_POST['suchstring'];
   @$feld = $_POST['select'];
   include("include/connect.inc.php");
   $sqlab = "select v.id, b.titel, b.autor, b.isbn, b.inhalt, b.auflage, b.standort, v.zustand from buecher b, verleih v";
   $sqlab .= "where b.id = v.id AND $feld like '%$suchstring%' order by v.id";
   $fehler=0;
   if(!isset($suchstring) || $suchstring=="")
   {
    echo '<font class="fliesstext">Sie haben keinen Suchbegriff eingegeben!<br></font>'; $fehler=1;
    echo '<a class="link" href="buechersuche.php">zurück</a><p>';
   }
   elseif($fehler==0)

$res= mysql_query($sqlab);
      $num = mysql_affected_rows();
   if ($num>0)
   {
     echo "<font class="fliesstext">Es wurde(n) $num Datensa(ä)tz(e) gefunden:<p></font>";
     // Tabellenbeginn
     echo "<table class="fliesstext" bgcolor="#e7e7e7" cellpadding="1" cellspacing="0" border="1" bordercolor="#ffffff">";
     // Kopfzeile der Tabelle ausgeben
     echo '<tr bgcolor="#666666" class="modultitle" width="40" align="center"> <td>ID</td> <td width="90" align="center">Titel</td> <td width="80" align="center">Autor</td> <td width="80" align="center">Verlag</td> <td width="85" align="center">ISBN</td> <td width="280" align="center">Inhalt</td>';
     echo '<td width="55" align="center">Auflage</td><td width="60" align="center">Standort</td><td width="70" align="center">Status</td><td width="70" align="center">Verleih</td></tr>';
     for ($i=0; $i<$num; $i++)
     {
       $id = mysql_result($res, $i, "id");
       $titel = mysql_result($res, $i, "titel");
       $autor = mysql_result($res, $i, "autor");
       $verlag = mysql_result($res, $i, "verlag");
       $isbn = mysql_result($res, $i, "isbn");
       $inhalt = mysql_result($res, $i, "inhalt");
       $auflage = mysql_result($res, $i, "auflage");
       $standort = mysql_result($res, $i, "standort");
       $status = mysql_result($res, $i, "status");

// Ausgabe des Suchergebnisses in Tabellenform
       echo "<tr class="footer" valign="top"> <td id="p1" valign="top">$id</td> <td id="p1" valign="top">$titel  </td> <td id="p1" valign="top">$autor</td> <td id="p1" valign="top">$verlag</td> <td align="center" valign="top">$isbn</td> <td id="p1" valign="top">$inhalt</td>";
       echo "<td align="center" valign="top">$auflage</td> <td align="center" valign="top">$standort</td> <td align="center" valign="top">$status</td> <td align="center" valign="top">$verleih</td></tr>";
     }
     echo "</table>";  // Tabellenende
        }
   elseif($fehler==0)
   {
    echo '<font class="fliesstext">Es wurde kein Datensatz gefunden, der Ihrer Suchanfrage entspricht</font><p>';
    }
    mysql_close($connect);
}

?>

</head>
<body>
<?php if(!isset($_POST['gesendet'])) { ?>
<font class="fliesstext">Bitte geben Sie hier ein was Sie suchen! Waehlen Sie anschliessend ein Suchfeld aus!</font>
<form action="buechersuche.php" method="post">
  <input type="text" name="suchstring">
  <select class="formInput" name="select">
  <option value="id">ID</option>
  <option value="titel">Titel</option>
  <option value="autor">Autor</option>
  <option value="verlag">Verlag</option>
  <option value="isbn">ISBN</option>
  <option value="inhalt">Inhalt</option>
  <option value="auflage">Auflage</option>
  <option value="standort">Standort</option>
  <option value="status">Status</option>
  </select>
  <input type="submit" class="submitButton" name="gesendet" value="Suchen">
</form>
<?php
}

?>
          </td>
        </tr>
        <tr>
          <td width="390"><img src="images/0.gif" width="1" height="30"></td>
          <td width="10"> </td>
          <td width="190"> </td>
        </tr>
        <tr>
          <td width="390" class="footer">
            © 2003 Deutsche Telekom AG</td>
          <td width="10"> </td>
          <td width="190" align="left" class="breadcrumb"><a href="#topofpage" class="Breadcrumb" target="_self"><img src="images/icons/icon_top.gif" alt="" width="11" height="12" border="0" /></a><img src="images/0.gif" alt="" width="9" height="1" border="0" /><a href="#topofpage" class="Link" target="_self">Top</a>
          </td>
        </tr>
        <tr>
          <td width="390"  class="fliesstext" valign="top"> </td>
          <td width="10"> </td>
          <td width="190" valign="top"> </td>
        </tr>
      </table>
    </td>
 </tr>
</table>

</body>
</html>