i am working on this script for my boss but it is giving my headaches.
This script loads a csv file, it has 6 rows starting with 0, they are divided in parts
The script normally shows what i fill in at parts[5]
In this case if ( $parts[5] == 5400), so it is supposed to only show the entries that have 5400 in row 5
Well, that works.
Now the problem begins, i also have a script with some sort of pagination, it has a previous and next button.
That also works, if you press next, you get the next 6 products.
The problem now is that those 2 options won't combine, i don't know why, but when i have the entries from if ( $parts[5] == 5400) shown, i can press next all i want but nothing happens.
Or, if i change the script, it shows blank pages, and when it finds a 5400 entry it only shows that.
But standard, like the script below, it just shows everything from the CSV file.
So what i want is, the selection i made ( if ( $parts[5] == 9999)) with the pagination
Can someone help me with this ?
I also tried to combine the 2 "if"s but it doesn't change a thing.
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body bgcolor=#E2E965 link=#812990 vlink=#812990 alink=#812990 text=black>
</html>
<?PHP
$offset = isset($_GET['offset'])?$_GET['offset']:0;
$LinesToDisplay = 6;
$row = $offset + $LinesToDisplay;
$row2 = $offset - $LinesToDisplay;
$file_handle = fopen("web.txt", "rb");
while ((($parts = fgetcsv($file_handle,4096,"|")) !== FALSE) && ($LinesToDisplay > 0) && (!feof($file_handle)))
{
//new code
//skip first $offset lines
if ($offset-- > 0)
{
continue;
}
///////////////////////////
$num = count($parts[1]);
if ( $parts[5] == 5400)
$parts[0] = ucwords(strtolower($parts[0]));
$parts[1] = ucwords(strtolower($parts[1]));
echo "<p><a class='popup4' href='#'><font size=-1 face=Humanist777BT-ExtraBlackB><b>$parts[0]</b></font>";
echo "<table><tr><td><i>";
echo "<span class='comment'>$parts[1]</span></td></tr></table></i></a>";
echo "<TABLE BORDER='0' cellpadding='0' CELLSPACING='0'><TR><TD WIDTH='70' HEIGHT='20' BACKGROUND='pricebackground.jpg' VALIGN='bottom'><center><font
color=white>€". $parts[2] ."</center></td></tr></table>";
echo "<b><font size=3 color=#D7182A>Op Voorraad In:<br></font>";
echo (" Amsterdam ");
if ( $parts[3] >= 1 ) echo ("<IMG SRC =green.gif>")."";
if ( $parts[3] == 0 ) echo ("<IMG SRC =red.gif>")."";
echo (" Utrecht ");
if ( $parts[4] >= 1 ) echo ("<IMG SRC =green.gif>")."<div class='spacer_black'></div></b>";
if ( $parts[4] == 0 ) echo ("<IMG SRC =red.gif>")."<div class='spacer_black'></div></b>";
//new code
//By here we decrement the line to display, when this reaches 0 the loop will stop
$LinesToDisplay--;
//////////////////////////////
}
fclose($file_handle);
?>
<html>
<BR><a href="occasion.php?offset=<?php echo $row2;?>">Previous</a> - <a href="occasion.php?offset=<?php echo $row;?>">Next</a></html>