Problems with Undefined index
Please do somebody help me with this: each time that I run the program, I receive those erros:
Notice: Undefined index: startLimit in D:\Program Files\Apache Group\Apache2\htdocs\DoJoSolutions\Books_Lister.php on line 36
Notice: Undefined index: rows in D:\Program Files\Apache Group\Apache2\htdocs\DoJoSolutions\Books_Lister.php on line 37
Notice: Undefined index: sortBy in D:\Program Files\Apache Group\Apache2\htdocs\DoJoSolutions\Books_Lister.php on line 38
Notice: Undefined index: sortOrder in D:\Program Files\Apache Group\Apache2\htdocs\DoJoSolutions\Books_Lister.php on line 39
Notice: Undefined variable: orderByQuery in D:\Program Files\Apache Group\Apache2\htdocs\DoJoSolutions\Books_Lister.php on line 66
Notice: Undefined index: startLimit in D:\Program Files\Apache Group\Apache2\htdocs\DoJoSolutions\Books_Lister.php on line 88
This are part of my codes:
<?
$initStartLimit = 0;
$limitPerPage = 10;
$startLimit = $_REQUEST['startLimit'];
$numberOfRows = $_REQUEST['rows'];
$sortBy = $_REQUEST['sortBy'];
$sortOrder = $_REQUEST['sortOrder'];
if ($startLimit=="")
{
$startLimit = $initStartLimit;
}
if ($numberOfRows=="")
{
$numberOfRows = $limitPerPage;
}
if ($sortOrder=="")
{
$sortOrder = "DESC";
}
if ($sortOrder == "DESC") { $newSortOrder = "ASC"; } else { $newSortOrder = "DESC"; }
$limitQuery = " LIMIT ".$startLimit.",".$numberOfRows;
$nextStartLimit = $startLimit + $limitPerPage;
$previousStartLimit = $startLimit - $limitPerPage;
if ($sortBy!="")
{
$orderByQuery = " ORDER BY ".$sortBy." ".$sortOrder;
}
$sql = "SELECT * FROM libo_books".$orderByQuery.$limitQuery;
$result = MYSQL_QUERY($sql);
$numberOfRows = MYSQL_NUM_ROWS($result);
?>
<?
if ($numberOfRows==0) {
?>
Sorry. No records found !!
<?
}
else if ($numberOfRows>0) {
$i=0;
?>
<br>
<?
if ($_REQUEST['startLimit'] != "")
{
?>
<a href="<? echo $_SERVER['PHP_SELF']; ?>?startLimit=<? echo $previousStartLimit; ?>&limitPerPage=<? echo $limitPerPage; ?>&sortBy=<? echo $sortBy; ?>&sortOrder=<? echo $sortOrder; ?>">Previous <? echo $limitPerPage; ?> Results</a>....
<? } ?>
<?
if ($numberOfRows == $limitPerPage)
{
?>
<a href="<? echo $_SERVER['PHP_SELF']; ?>?startLimit=<? echo $nextStartLimit; ?>&limitPerPage=<? echo $limitPerPage; ?>&sortBy=<? echo $sortBy; ?>&sortOrder=<? echo $sortOrder; ?>">Next <? echo $limitPerPage; ?> Results</a>
<? } ?>
Please, Do somebody give an Idea how to get over this erros.
Thanks.