Pagination/search/sorting probleem
1)
Bij het zoeken via het fomulier: Als ik de eerste keer iets ingeef herlaad hij de pagina maar doet ... vrijwel niets.. buiten dit in de url ?pageNum_RsMonitor=0&totalRows_RsMonitor=1852&Columnname=PODate&OrderWay=&q= toevoegen.. Als ik nu een 2de x het invul (of zelfs gewoon leeg laat en op zoeken klik.. dan gaat ie wel... :/ stwange
2)
De sorting images verandert alleen van unsorted tot descending maar niet in ascending (blijft op descending staan..)
Ik Hoop dat jullie ze vinden. :( Dank bij voorbaat
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<?php
//CHECK FOR SORTING
if ((!isset($_GET['Columnname']))&&(!isset($_GET['OrderWay'])))
{
//if nothing is chosen to sort, choose a default sorting
$Columnname = "PODate";
$OrderWay = "DESC";
}
else
{
if ($_GET['OrderWay'] == "DESC")
{
$Columnname = $_GET['Columnname'];
$OrderWay = "ASC";
} else {
$Columnname = $_GET['Columnname'];
$OrderWay = "DESC";
}
}
$OrderColumn = "&Columnname=".$Columnname;
$OrderString = "&OrderWay=".$OrderWay;
$startRow_RsMonitor = $pageNum_RsMonitor * $maxRows_RsMonitor;
$query_RsMonitor = "SELECT * FROM POGeneral";
//Start making the query
if(isset($_post['Searchitem']))
{
//WHEN SEARCH ITEM IS GIVEN THROUGH POST
$zoek = $_POST['Searchitem'];
}
elseif(isset($_GET['q']))
{
//WHEN SEARCH ITEM IS NOT GIVEN THROUGH POST
$zoek = $_GET['q'];
}
//WHEN SEARCH ITEM IS NOT GIVEN THROUHG POST OR GET
else {$zoek = "";}
//WHEN THERE IS A SEARCH ITEM VALUE
if(!empty($zoek))
//BUILD SEARCH QUERY
{
function Direction($column)
{
$querystring = $_SERVER['QUERY_STRING'];
if (strpos($querystring, $column) != false)
{
$sorting = $_GET['OrderWay'];
if ($sorting = "ASC") {return "public/media/images/ascending.gif";}
elseif ($sorting = "DESC") {return "public/media/images/descending.gif";}
else return "public/media/images/unsorted.gif";
}
return "public/media/images/unsorted.gif";
}
?>
//CHECK FOR SORTING
if ((!isset($_GET['Columnname']))&&(!isset($_GET['OrderWay'])))
{
//if nothing is chosen to sort, choose a default sorting
$Columnname = "PODate";
$OrderWay = "DESC";
}
else
{
if ($_GET['OrderWay'] == "DESC")
{
$Columnname = $_GET['Columnname'];
$OrderWay = "ASC";
} else {
$Columnname = $_GET['Columnname'];
$OrderWay = "DESC";
}
}
$OrderColumn = "&Columnname=".$Columnname;
$OrderString = "&OrderWay=".$OrderWay;
$startRow_RsMonitor = $pageNum_RsMonitor * $maxRows_RsMonitor;
$query_RsMonitor = "SELECT * FROM POGeneral";
//Start making the query
if(isset($_post['Searchitem']))
{
//WHEN SEARCH ITEM IS GIVEN THROUGH POST
$zoek = $_POST['Searchitem'];
}
elseif(isset($_GET['q']))
{
//WHEN SEARCH ITEM IS NOT GIVEN THROUGH POST
$zoek = $_GET['q'];
}
//WHEN SEARCH ITEM IS NOT GIVEN THROUHG POST OR GET
else {$zoek = "";}
//WHEN THERE IS A SEARCH ITEM VALUE
if(!empty($zoek))
//BUILD SEARCH QUERY
{
function Direction($column)
{
$querystring = $_SERVER['QUERY_STRING'];
if (strpos($querystring, $column) != false)
{
$sorting = $_GET['OrderWay'];
if ($sorting = "ASC") {return "public/media/images/ascending.gif";}
elseif ($sorting = "DESC") {return "public/media/images/descending.gif";}
else return "public/media/images/unsorted.gif";
}
return "public/media/images/unsorted.gif";
}
?>
Het formuliertje
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<form method="POST" action="http://xxx.xxx.xxx.xxx/test/index.php<?php echo "?pageNum_RsMonitor=".$pageNum_RsMonitor.$queryString_RsMonitor.$OrderColumn."&OrderWay=".$_GET['OrderWay']."&q=".$_POST['Searchitem'] ?>">
<input type="text" name="Searchitem" value=<?php echo $zoek;?>><input value="Search" type="submit">
</form>
</td>
</tr>
</table>
<center>
<table cellpadding="3" width="100%">
<thead>
<tr><strong>
<td align="center">F report</td>
<td align="center">S report</td>
<td align="center">
<a href="<?php echo "?pageNum_RsMonitor=".$pageNum_RsMonitor.$queryString_RsMonitor."&Columnname=PONum".$OrderString."&q=".$zoek; ?>">PO Number <img src="<?php echo Direction('PONum'); ?>"</a></td>
<input type="text" name="Searchitem" value=<?php echo $zoek;?>><input value="Search" type="submit">
</form>
</td>
</tr>
</table>
<center>
<table cellpadding="3" width="100%">
<thead>
<tr><strong>
<td align="center">F report</td>
<td align="center">S report</td>
<td align="center">
<a href="<?php echo "?pageNum_RsMonitor=".$pageNum_RsMonitor.$queryString_RsMonitor."&Columnname=PONum".$OrderString."&q=".$zoek; ?>">PO Number <img src="<?php echo Direction('PONum'); ?>"</a></td>
Gewijzigd op 01/01/1970 01:00:00 door Pieter
En nu mogen wij gaan zoeken?
Ik heb mijn probleem zo duidelijk mogelijk proberen te stellen :/