Patrick: nur die datensätze zählen die wirklich angezeigt werden

Beitrag lesen

Hallo

$anz_reihen = mysql_num_rows( $ergebnis );
$anzahl = $anz_reihen / $limit + 0.99;
$seite = $start / $limit + 1;
für was ist das alles? was steht in $start?

für die ausgabe von seitenanzahl und aktuelle anzahl von seiten.

} else {
 $zurueck = "zurück | ";
mhh... warum gibst du dann zurück einfach ohne Link aus und lässt es nicht ganz weg?

ja ich find es sieht besser aus.

hier der ganze code:
<?php
if ($gesch == "m") {
$model = "w";

} elseif ($gesch == "w") {
$model = "m";
}
include("../db.inc.php");
$host     = "localhost";
$user     = "$benutzer";
$password = "$passwort";
$database = "$db";
$table    = "sd_models";
$id       = "model_id";

// Datendefinition für die Clientausgabe
$start = (isset($start)) ? abs((int)$start) : 0;
$limit = 3;                     // Datensätze pro Ausgabeseite

// Verbindung zu MySQL-Datenbank herstellen oder sterben.
@mysql_connect($host,$user,$password)
   or die("Abbruch: Verbindung zu '$host'"
         ." konnte nicht hergestellt werden.");

// Benötigte Datenbank auswählen oder sterben.
@mysql_select_db($database)
   or die("Abbruch: Datenbank konnte nicht"
         ." selektiert werden.<br><br>MySQL sagt: ".mysql_error());

// Feststellen der Anzahl der verfügbaren Datensätze.
$resultID = @mysql_query("SELECT COUNT(model_id) FROM ");
$total    = @mysql_result($resultID,0);

$start    = ($start >= $total) ? $total - $limit : $start;

// Datenbankabfrage ausführen.
$query    = "SELECT * FROM ".$table." ORDER BY model_id DESC"." LIMIT ".$start.",".$limit;
$resultID = @mysql_query($query);

// Seitenanzahl anzeigen.
$ergebnis = mysql_query( "SELECT * FROM ".$table );
$anz_reihen = mysql_num_rows( $ergebnis );
$anzahl = $anz_reihen / $limit + 0.99;
$seite = $start / $limit + 1;
settype($anzahl, integer);

if ($start > 0) {
 $newStart = ($start - $limit < 0) ? 0 : ($start-$limit);
   $zurueck = "<a href=".$PHP_SELF."?start=".$newStart."&gesch=".$gesch.">zurück</a> | ";
} else {
 $zurueck = "zurück | ";
  }

if ($start + $limit < $total) {
 $newStart = $start + $limit;
   $weiter = " | <a href=".$PHP_SELF."?start=".$newStart."&gesch=".$gesch.">weiter</a>";
} else {
 $weiter = " | weiter";
  }
?>
<html>
 <head>
  <title>Models <?php print $gesch; ?>.</title>
  <link rel="stylesheet" type="text/css" href="../styles/style.css">
 </head>
 <body>
<div align="center">
  <table border="0" cellpadding="0" cellspacing="10">
    <tr valign="top">
  <td height="80">
         <div align="center">
    <h2>Models <?php print $gesch; ?>.</h2>
   </div>
  </td>
  <td width="69" height="80"></td>
 </tr>
 <tr>
  <td>Klicke auf das Bild um die SedCard zu betrachten!</td>
  <td width="69"></td>
 </tr>
 <tr>
  <td>
   <div align="center">
    <?php print $zurueck."Seite ".$seite." von ".$anzahl.$weiter; ?>
   </div>
  </td>
  <td width="69"></td>
 </tr>
</table>
<table width="616" border="0" cellpadding="0" cellspacing="10">
    <tr>
 <?php
 $n=0;
 while ( $data = mysql_fetch_array($resultID) ) {
  if ( empty($data['user'])        || empty($data['name'])        || empty($data['gebdatum'])  || empty($data['postleitzahl']) ||
      empty($data['land'])        || empty($data['wohnort'])     || empty($data['email'])     || empty($data['groesse']) ||
      empty($data['masse'])       || empty($data['konfektions']) || empty($data['bh_kragen']) || empty($data['haarfarbe']) ||
      empty($data['haarlaenge'])  || empty($data['augenfarbe'])  || empty($data['hauttyp'])   || empty($data['schuhg']) ||
      empty($data['einsatz_tab']) ||
             $data['geschlecht'] == "$model" ) {
   //Daten unvollständig
  } elseif (file_exists("../images/models/".$data['geschlecht'].$data['model_id']."/bild1.jpg") AND
      file_exists("../images/models/".$data['geschlecht'].$data['model_id']."/bild2.jpg")) { ?>
  <td>
  <div align="center">
  <table border="0" cellpadding="0" cellspacing="2">
            <tr height="100">
     <td height="100" width="150"><a href="http://www.models-planet.de/php/sedcard.php?user=<?php print $data['user']; ?>"><img src="http://www.models-planet.de/images/models/<?php print $data['geschlecht']; ?><?php print $data['model_id']; ?>/bild1.jpg" border="1" width="72" boardercolor="#000000"></a></td>
    </tr>
    <tr>
     <td width="150"><?php print $data['name']; ?></td>
    </tr>
    <tr>
     <td width="150"><font size="1"><?php print $data['land']; ?>-<?php print $data['postleitzahl']; ?> <?php print $data['wohnort']; ?></font></td>
    </tr>
   </table>
  </div>
  </td>
 <?php
 if($n%2 == 1) {
  print "</tr>";
      print "<tr>";
 }
 $n++;
     }
 }
 ?>
 </tr>
</table>
<table border="0" cellpadding="0" cellspacing="10">
 <tr>
  <td width="273">
   <div align="center">
    <?php print $zurueck."Seite ".$seite." von ".$anzahl.$weiter; ?>
   </div>
  </td>
  <td width="69"></td>
 </tr>
</table>
</div>
 </body>
</html>
<?php
mysql_close();
?>

Mit freundlichen Grüssen,
Patrick