page turning script error
Posted: Wed Jan 25, 2006 2:45 am
hey guys i have a big problem with my function.
it is supposed to change the site after a certain amount of datasets/rows.
but when i put in more than 23 rows per page it starts with the table headers again instead of a new row.
sometimes it also goes completly nuts and just keeps on printing out datasets without stopping (when you put the rows per page limit on more than 30). but it works fine with everythig under 23. i dont have any idea what it could be. if someone could have a look at it
PLEASE
it is supposed to change the site after a certain amount of datasets/rows.
but when i put in more than 23 rows per page it starts with the table headers again instead of a new row.
sometimes it also goes completly nuts and just keeps on printing out datasets without stopping (when you put the rows per page limit on more than 30). but it works fine with everythig under 23. i dont have any idea what it could be. if someone could have a look at it
Code: Select all
error_reporting(E_All);
include("connect.php");
$sqlab = "SELECT sam_date_val.Incdate,sam_date_val.Customernr,sam_date_val.Projnr,sam_bestellung.Area,sam_bestellung.Groupp FROM sam_date_val,sam_bestellung WHERE sam_bestellung.projnr=sam_date_val.projnr AND sam_bestellung.customernr=sam_date_val.customernr ORDER BY customernr";
mysql_select_db('safe');
$daten = mysql_query($sqlab) OR die(mysql_error());
$num = mysql_num_rows($daten);
$rows_per_page = 23; // THE LIMIT
$max_sets = 1000;
if ($num > $max_sets) {
echo "<br>Too many<br><br>";
$num = $max_sets;
}
for ($i =0; $i<$rows_per_page; $i++) {
$mail = @mysql_result($daten,$i, "mail");
if (isset ($_GET['page'])) {
$page = $_GET['page'];
$start=$page * $rows_per_page;
}
else {
$start = 0;
$page = 0;
}
$sqlab = "SELECT sam_date_val.Incdate,sam_date_val.Customernr,sam_date_val.Projnr,sam_bestellung.Area,sam_bestellung.Groupp FROM sam_date_val,sam_bestellung WHERE sam_bestellung.projnr=sam_date_val.projnr AND sam_bestellung.customernr=sam_date_val.customernr ORDER BY customernr LIMIT $start,$Zeilen_pro_Seite";
$daten = mysql_query($sqlab) OR die(mysql_error());
$mail = @mysql_result($daten,$i, "mail");
echo "<table border=\"4\", align=\"center\", cellpadding=\"3\", rules=\"all\"><caption style=\"caption-side:top;\"><strong>Present Orders List</strong></caption>\n";
echo " <tr>\n";
echo"
<th nowrap>Incoming Date</th>
<th nowrap colspan=\"2\">Project No</th>
<th nowrap>Area</th>
<th nowrap>Group</th>
";
echo " </tr>\n";
while ($row = mysql_fetch_row($daten)){
echo " <tr>\n";
echo"
<td>$row[0]</td>
<td colspan=\"2\">$row[1]$row[2]</td>";
for ($i = 3; $i < mysql_num_fields($daten); $i++){
echo " <td>$row[$i]</td>\n";
}
echo " </tr>\n";
}
echo "</table>\n";
}
echo "<br>";
if ($num > $rows_per_page) {
$seiten=floor($num/$rows_per_page);
if ($seiten == $num/$rows_per_page) {
$schluss = $seiten;
}
if ($seiten < $num/$rows_per_page) {
$seiten++;
$schluss = $seiten;
}
}
if (isset($seiten)) {
for ($a =0; $a<$seiten; $a++) {
$mail = @mysql_result($daten,$a, "mail");
if ($a == 0) {
echo "<A HREF=\"update_order_all.php?page=$a\">Seite 1</A>";
}
if (($a > 0) And (($a +1) < $schluss)) {
$b = $a + 1;
echo "<A HREF=\"update_order_all.php?page=$a\">$b</A>";
}
if (($a +1 ) == $schluss) {
echo "<A HREF=\"update_order_all.php?page=$a\">letzte Seite</A>";
}
if (($a + 1) < ($seiten)) {
echo " | ";
}
}