Dateiname: table.php

Code - ab nachfolgender Zeile kopieren und unter table.php speichern:

<?php

sleep(1);
$i = 0;

$con = mysql_connect("host","datenbank","passwort");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }
mysql_select_db("datenbank", $con);
$result = mysql_query("SELECT id, vorname, name, strasse,plz, ort
FROM einwohner order by name");

echo "<table align='center' width='100%'>";
echo "<tr style='background:#9EB7BC;font-weight:bold;'>";
echo "<td>Vorname</td>";
echo "<td>Name</td>";
echo "<td>Staße</td>";
echo "<td>PLZ</td>";
echo "<td>Ort</td>";
echo "</tr>";

while($row = mysql_fetch_array($result)){

  $i++;
  if(round($i/2) == $i/2){
    echo "<tr onClick=requesT_A(this.id) id='" . $row['id']
    . "' class='a' onmouseover=this.className='c'
    onmouseout=this.className='a'><td>" . $row['vorname']
    . "</td><td>" . $row['name'] . "</td><td>"
    . $row['strasse'] . "</td><td>" . $row['plz']
    . "</td><td>" . $row['ort'] . "</td></tr>";
    }else{
    echo "<tr onClick=requesT_A(this.id) id='" . $row['id']
    . "' class='b' onmouseover=this.className='c'
    onmouseout=this.className='b'><td>" . $row['vorname']
    . "</td><td>" . $row['name'] . "</td><td>"
    . $row['strasse'] . "</td><td>" . $row['plz'] . "</td><td>"
    . $row['ort'] . "</td></tr>";
  }

}

echo "</table>";

mysql_close($con);

?>

Code - bis zur obigen Zeile kopieren und unter table.php speichern: