Expand|Select|Wrap|Line Numbers
- <? //Pagination functions function getPagingQuery($sql, $itemPerPage = 10) { if (isset($_GET['page']) && (int)$_GET['page'] > 0) { $page = (int)$_GET['page']; } else { $page = 1; } // start fetching from this row number $offset = ($page - 1) * $itemPerPage; return $sql . " LIMIT $offset, $itemPerPage"; } /* Get the links to navigate between one result page to another. */ function getPagingLink($sql, $itemPerPage = 10, $strGet = '') { $result = dbQuery($sql); $pagingLink = ''; $totalResults = dbNumRows($result); $totalPages = ceil($totalResults / $itemPerPage); // how many link pages to show $numLinks = 10; // create the paging links only if theres more than one page of results if ($totalPages > 1) { $self = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'] ; if (isset($_GET['page']) && (int)$_GET['page'] > 0) { $pageNumber = (int)$_GET['page']; } else { $pageNumber = 1; } // print 'previous' link only if its not // on page one if ($pageNumber > 1) { $page = $pageNumber - 1; if ($page > 1) { $prev = " <a href=\"$self?page=$page&$strGet/\">[Prev]</a> "; } else { $prev = " <a href=\"$self?$strGet\">[Prev]</a> "; } $first = " <a href=\"$self?$strGet\">[First]</a> "; } else { $prev = ''; // on page one, don't show 'previous' link $first = ''; // nor 'first page' link } // print 'next' link only if its not // on the last page if ($pageNumber < $totalPages) { $page = $pageNumber + 1; $next = " <a href=\"$self?page=$page&$strGet\">[Next]</a> "; $last = " <a href=\"$self?page=$totalPages&$strGet\">[Last]</a> "; } else { $next = ''; // if on the last page, don't show 'next' link $last = ''; // nor 'last page' link } $start = $pageNumber - ($pageNumber % $numLinks) + 1; $end = $start + $numLinks - 1; $end = min($totalPages, $end); $pagingLink = array(); for($page = $start; $page <= $end; $page++) { if ($page == $pageNumber) { $pagingLink[] = " $page "; // no need to create a link to current page } else { if ($page == 1) { $pagingLink[] = " <a href=\"$self?$strGet\">$page</a> "; } else { $pagingLink[] = " <a href=\"$self?page=$page&$strGet\">$page</a> "; } } } $pagingLink = implode(' | ', $pagingLink); // return the page navigation link $pagingLink = $first . $prev . $pagingLink . $next . $last; } return $pagingLink; } ?>
However, when I add the pagination to my DB functions containing SQLs, it doesn't work. Code below:
Expand|Select|Wrap|Line Numbers
- <? function allsales_Today() { $rowsPerPage = 5; //$sql = 'SELECT * FROM cstocksales WHERE SaleDate = current_date'; $sql = 'SELECT * FROM cstocksales WHERE DATE_SUB(CURDATE(),INTERVAL 1 DAY) <= SaleDate'; //$result = dbQuery($sql); $result = dbQuery(getPagingQuery($sql, $rowsPerPage)); $pagingLink = getPagingLink($sql, $rowsPerPage); if (dbNumRows($result) == 0) //if none { echo '<p><font color=#CC0000><h4>No sales for today were found in the records...</h4></font></p>'; echo 'Go back <a href="index.php">Here</a> for another search.'; } else { echo "<h5>Today's sales sales:<p></h5>"; echo '<table width="100%" border="1" bordercolor="#000000">'; echo'<tr>'; echo'<th scope="col" bgcolor="#66FFFF">Sale No</th>'; echo'<th scope="col" bgcolor="#66FFFF">Category</th>'; echo'<th scope="col" bgcolor="#66FFFF">Brand</th>'; echo'<th scope="col" bgcolor="#66FFFF">Quantity </th>'; echo'<th scope="col" bgcolor="#66FFFF">Paid By: </th>'; echo'<th scope="col" bgcolor="#66FFFF">Amount </th>'; echo'<th scope="col" bgcolor="#66FFFF">Date of Sale </th>'; echo'</tr>'; while($row = dbFetchArray($result)) // while($row = mysql_fetch_array($result)) { echo'<tr>'; echo'<td align="center">'; $SaleID = $row["SaleID"]; echo $SaleID. "<br>"; echo'</td align="center">'; echo'<td align="center">'; $Category = $row["Category"]; echo $Category. "<br>"; echo'</td align="center">'; echo'<td align="center">'; $Brand = $row["Brand"]; echo $Brand. "<br>"; echo'</td align="center">'; echo'<td align="center">'; $Quantity = $row["Quantity"]; echo $Quantity. "<br>"; echo'</td align="center">'; echo'<td align="center">'; $PaidBy = $row["PaidBy"]; echo $PaidBy. "<br>"; echo'</td align="center">'; echo'<td align="center">'; $Cost = $row["Cost"]; echo $Cost. "<br>"; echo'</td align="center">'; echo'<td align="center">'; $SaleDate = $row["SaleDate"]; echo $SaleDate. "<br>"; echo'</td align="center">'; echo '</tr>'; } echo'</table>'; //paginating link echo $pagingLink; echo "<br>"; echo "<strong>Sales figures:</strong>"; echo "<hr>"; $sql_total = 'SELECT PaidBy, SUM(Cost) FROM cstocksales WHERE DATE_SUB(CURDATE(),INTERVAL 1 DAY) <= SaleDate GROUP BY PaidBy'; $result = dbQuery($sql_total); while($row = dbFetchArray($result)) { echo "Total sales by ". $row['PaidBy']. "<font color=#CC0000> = Kshs <strong>". $row['SUM(Cost)']; echo "</font></strong>"; echo " "; echo"|"; echo " "; } $sql_total_final = 'SELECT SUM(Cost) FROM cstocksales WHERE DATE_SUB(CURDATE(),INTERVAL 1 DAY) <= SaleDate'; $result = dbQuery($sql_total_final); while($row = dbFetchArray($result)) { echo "<strong>All sales = <font color=#CC0000> Kshs " .$row['SUM(Cost)']; echo "</font></strong>" ; } } echo "<br>"; echo '<h4><a href="index.php">Back</a> to sales panel.'; } ?>
http://localhost/cstock/admin/viewsa...es.php?page=2&
The URL for the search should be
http://localhost/cstock/admin/viewsa...=allsalestoday
Followed by the pagination as a user clicks next or a value in the pagination link
viewsales.php is the file containing sales functions
It only works if I put each function in its own page. My sales functions are many (33 functions) and so they are all in one file called view sales.php in a case statement.
How do I make it work if I have a file that contains all my sales functions and I want to use the pagination in each function?
my pagination function is in a file I call at the top of every page (functions.php)
Expand|Select|Wrap|Line Numbers
- <? //Pagination functions function getPagingQuery($sql, $itemPerPage = 10) { if (isset($_GET['page']) && (int)$_GET['page'] > 0) { $page = (int)$_GET['page']; } else { $page = 1; } // start fetching from this row number $offset = ($page - 1) * $itemPerPage; return $sql . " LIMIT $offset, $itemPerPage"; } /* Get the links to navigate between one result page to another. */ function getPagingLink($sql, $itemPerPage = 10, $strGet = '') { $result = dbQuery($sql); $pagingLink = ''; $totalResults = dbNumRows($result); $totalPages = ceil($totalResults / $itemPerPage); // how many link pages to show $numLinks = 10; // create the paging links only if theres more than one page of results if ($totalPages > 1) { $self = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'] ; if (isset($_GET['page']) && (int)$_GET['page'] > 0) { $pageNumber = (int)$_GET['page']; } else { $pageNumber = 1; } // print 'previous' link only if its not // on page one if ($pageNumber > 1) { $page = $pageNumber - 1; if ($page > 1) { $prev = " <a href=\"$self?page=$page&$strGet/\">[Prev]</a> "; || $prev = " <a href=\"$self?action=$action&$strGet/\">[Prev]</a> "; } else { $prev = " <a href=\"$self?$strGet\">[Prev]</a> "; } $first = " <a href=\"$self?$strGet\">[First]</a> "; } else { $prev = ''; // on page one, don't show 'previous' link $first = ''; // nor 'first page' link } // print 'next' link only if its not // on the last page if ($pageNumber < $totalPages) { $page = $pageNumber + 1; $next = " <a href=\"$self?page=$page&$strGet\">[Next]</a> "; || " <a href=\"$self?action=$action&$strGet/\">[Prev]</a> "; $last = " <a href=\"$self?page=$totalPages&$strGet\">[Last]</a> "; || " <a href=\"$self?action=$action&$strGet/\">[Prev]</a> "; } else { $next = ''; // if on the last page, don't show 'next' link $last = ''; // nor 'last page' link } $start = $pageNumber - ($pageNumber % $numLinks) + 1; $end = $start + $numLinks - 1; $end = min($totalPages, $end); $pagingLink = array(); for($page = $start; $page <= $end; $page++) { if ($page == $pageNumber) { $pagingLink[] = " $page "; // no need to create a link to current page } else { if ($page == 1) { $pagingLink[] = " <a href=\"$self?$strGet\">$page</a> "; } else { $pagingLink[] = " <a href=\"$self?page=$page&$strGet\">$page</a> "; } } } $pagingLink = implode(' | ', $pagingLink); // return the page navigation link $pagingLink = $first . $prev . $pagingLink . $next . $last; } return $pagingLink; } ?>
Expand|Select|Wrap|Line Numbers
- <?php if (!defined('WEB_ROOT')) { exit; } $rowsPerPage = 5; $_SESSION['login_return_url'] = $_SERVER['REQUEST_URI']; checkUser(); $sql = "SELECT * FROM fragrancestock"; $result = dbQuery(getPagingQuery($sql, $rowsPerPage)); $pagingLink = getPagingLink($sql, $rowsPerPage); $errorMessage = (isset($_GET['cstock_error']) && $_GET['cstock_error'] != '') ? $_GET['cstock_error'] : ' '; ?> <form action="index.php?view=add" method="post" name="frmList" id="frmList"> <table width="100%" border="0" align="center"> <tr class="title_text"> <td width="100">Category</td> <td width="400">Brand</td> <td width="100" align="center">Stock</td> <td width="100">Date Added</td> <td width="50">Details</td> <td width="50">Add</td> <td width="50">Delete</td> </tr> <?php if (dbNumRows($result) > 0) { $i = 0; while($row = dbFetchAssoc($result)) { extract($row); if ($i%2) { $class = 'row1'; } else { $class = 'row2'; } $i += 1; ?> <tr class="<?php echo $class; ?>"> <td width="100"><?php echo $Category; ?></td> <td width="400"><?php echo $Brand; ?></td> <td width="100" class="inner_border"><?php echo $Quantity; ?></td> <td width="100"><?php echo $DateAddedStock; ?></td> <td width="50"><a href="<?php echo $_SERVER['PHP_SELF']; ?>?view=detail&StockID=<?php echo $StockID; ?>">View</a></td> <td width="50"><a href="javascript:modifyStock(<?php echo $StockID; ?>);"><strong>Add </strong> </a></td> <td width="50"><a href="javascript:deleteStock(<?php echo $StockID; ?>);">Delete</a></td> </tr> <?php } // end while ?> <tr> <td colspan="7" align="center"> <?php echo $pagingLink; ?> </td> </tr> <?php } else { ?> <tr> <td colspan="7" align="center">No Stock Items Yet</td> </tr> <?php } ?> <tr> <td colspan="7"> </td> </tr> <tr> <td colspan="7" align="right"> <input name="btnAddStock" type="submit" value="New Entry" class="button_image"> </tr> </table> </form> <label class="title_text">View Stock:</label> <hr> <table width="100%" border="0"> <tr> <td><form action="index.php?view=showbybrand" method="post" name="frmByBrand"> <table width="100%" border="0"> <tr> <td width="200">By Brand:</td> <td width="200"><select name="sltBrand"> <option value="0">Select Brand</option> <? $sql = "SELECT DISTINCT Brand FROM cstockitems ORDER BY Brand ASC"; $result = dbQuery($sql); if(dbNumRows($result)) { while($row = dbFetchAssoc($result)) { echo "<option>$row[Brand]</option>"; } } else { echo "<option>No Brands Present</option>"; } ?> </select></td> <td width="200"><input type="submit" name="Submit" value="Show" class="button_image" onClick="return CheckShowBrandByBrand();"> </td> </tr> </table> </form></td> </tr> <tr> <td><form name="frmByCategory" method="post" action="showbycategory.php"> <table width="100%" border="0"> <tr> <td width="200">By Category:</td> <td width="200"><select name="sltCategory"> <option value="0">Select Category</option> <? $sql = "SELECT DISTINCT Category FROM cstockitems ORDER BY Category ASC"; $result = dbQuery($sql); if(dbNumRows($result)) { while($row = dbFetchAssoc($result)) { echo "<option>$row[Category]</option>"; } } else { echo "<option>No Categories Present</option>"; } ?> </select></td> <td width="200"><input type="submit" name="Submit2" value="Show" class="button_image" onClick="return CheckShowBrandByCategory();"></td> </tr> </table> </form></td> </tr> <tr> <td><form name="frmSearchBrand" method="post" action="showbysearch.php"> <table width="100%" border="0"> <tr> <td width="200">Search:</td> <td width="200"><input type="text" name="txtSearchBrand" size="40"></td> <td width="200"><input type="submit" name="Submit3" value="Search" class="button_image" onClick="return CheckShowBrandBySearch();"></td> </tr> </table> </form></td> </tr> </table> <label class="title_text">Print product list for re-stocking:</label> <hr> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td><a href="exportoutofstockfile.php">Out of stock:</a></td> <td><a href="exportlowstockfile.php">Low stock:</a></td> <td><a href="exportwarningstockfile.php">Stock running low:</a></td> <td><a href="printstocksheet.php">Print stock sheet</a></td> </tr> </table> <script> function CheckShowBrandByBrand() { form = window.document.frmByBrand; if (form.sltBrand.selectedIndex == 0) { alert('You have not selected a brand to view details!'); return false; } else { return true; } } function CheckShowBrandByCategory() { form = window.document.frmByCategory; if (form.sltCategory.selectedIndex == 0) { alert('You have not selected a Category to view details!'); return false; } else { return true; } } function CheckShowBrandBySearch() { form = window.document.frmSearchBrand; if (form.txtSearchBrand.value == "") { alert('You have not entered a brand name to search!'); return false; } else { return true; } } </script>
My problem is how to make it work in a page containing multiple functions AND it works in every function
Where should I change without having to make a pagination function for every POST function
My page of functions where I want to use it below:
Expand|Select|Wrap|Line Numbers
- <? require_once '../../functions.php'; $_SESSION['login_return_url'] = $_SERVER['REQUEST_URI']; checkUser(); $action = isset($_GET['action']) ? $_GET['action'] : ''; //$page = $_GET['action']; switch ($action) { case 'jan' : sales_January(); break; case 'feb' : sales_February(); break; case 'mar' : sales_March(); break; case 'april' : sales_April(); break; case 'may' : sales_May(); break; case 'june' : sales_June(); break; case 'july' : sales_July(); break; case 'aug' : sales_August(); break; case 'sept' : sales_September(); break; case 'oct' : sales_October(); break; case 'nov' : sales_November(); break; case 'dec' : sales_December(); break; case 'allsalestoday' : allsales_Today(); break; case 'allsalessevendays' : allsales_SevenDays(); break; case 'salesbycategory' : salesbyCategory(); break; case 'salesbybrand' : salesbyBrand(); break; default : } function allsales_Today($action) { $rowsPerPage = 2; //$sql = 'SELECT * FROM cstocksales WHERE SaleDate = current_date'; $sql = 'SELECT * FROM cstocksales WHERE DATE_SUB(CURDATE(),INTERVAL 1 DAY) <= SaleDate'; //$result = dbQuery($sql); $result = dbQuery(getPagingQuery($sql, $rowsPerPage)); $pagingLink = getPagingLink($sql, $rowsPerPage); if (dbNumRows($result) == 0) //if none { echo '<p><font color=#CC0000><h4>No sales for today were found in the records...</h4></font></p>'; echo 'Go back <a href="index.php">Here</a> for another search.'; } else { echo "<h5>Today's sales sales:<p></h5>"; echo '<table width="100%" border="1" bordercolor="#000000">'; echo'<tr>'; echo'<th scope="col" bgcolor="#66FFFF">Sale No</th>'; echo'<th scope="col" bgcolor="#66FFFF">Category</th>'; echo'<th scope="col" bgcolor="#66FFFF">Brand</th>'; echo'<th scope="col" bgcolor="#66FFFF">Quantity </th>'; echo'<th scope="col" bgcolor="#66FFFF">Paid By: </th>'; echo'<th scope="col" bgcolor="#66FFFF">Amount </th>'; echo'<th scope="col" bgcolor="#66FFFF">Date of Sale </th>'; echo'</tr>'; while($row = dbFetchArray($result)) // while($row = mysql_fetch_array($result)) { echo'<tr>'; echo'<td align="center">'; $SaleID = $row["SaleID"]; echo $SaleID. "<br>"; echo'</td align="center">'; echo'<td align="center">'; $Category = $row["Category"]; echo $Category. "<br>"; echo'</td align="center">'; echo'<td align="center">'; $Brand = $row["Brand"]; echo $Brand. "<br>"; echo'</td align="center">'; echo'<td align="center">'; $Quantity = $row["Quantity"]; echo $Quantity. "<br>"; echo'</td align="center">'; echo'<td align="center">'; $PaidBy = $row["PaidBy"]; echo $PaidBy. "<br>"; echo'</td align="center">'; echo'<td align="center">'; $Cost = $row["Cost"]; echo $Cost. "<br>"; echo'</td align="center">'; echo'<td align="center">'; $SaleDate = $row["SaleDate"]; echo $SaleDate. "<br>"; echo'</td align="center">'; echo '</tr>'; } echo'</table>'; //paginating link echo $pagingLink; echo "<br>"; echo "<strong>Sales figures:</strong>"; echo "<hr>"; $sql_total = 'SELECT PaidBy, SUM(Cost) FROM cstocksales WHERE DATE_SUB(CURDATE(),INTERVAL 1 DAY) <= SaleDate GROUP BY PaidBy'; $result = dbQuery($sql_total); while($row = dbFetchArray($result)) { echo "Total sales by ". $row['PaidBy']. "<font color=#CC0000> = Kshs <strong>". $row['SUM(Cost)']; echo "</font></strong>"; echo " "; echo"|"; echo " "; } $sql_total_final = 'SELECT SUM(Cost) FROM cstocksales WHERE DATE_SUB(CURDATE(),INTERVAL 1 DAY) <= SaleDate'; $result = dbQuery($sql_total_final); while($row = dbFetchArray($result)) { echo "<strong>All sales = <font color=#CC0000> Kshs " .$row['SUM(Cost)']; echo "</font></strong>" ; } } echo "<br>"; echo '<h4><a href="index.php">Back</a> to sales panel.'; } function allsales_SevenDays() { $sql = 'SELECT * FROM cstocksales WHERE DATE_SUB(CURDATE(),INTERVAL 8 DAY) <= SaleDate'; $result = dbQuery($sql); ///$result = dbQuery(getPagingQuery($sql, $rowsPerPage)); //$pagingLink = getPagingLink($sql, $rowsPerPage); if (dbNumRows($result) == 0) //if none { echo '<p><font color=#CC0000><h4>No sales for the past seven days were found in the records...</h4></font></p>'; echo 'Go back <a href="index.php">Here</a> for another search.'; } else { echo '<h5>Sales in the past seven days:<p></h5>'; echo '<table width="100%" border="1" bordercolor="#000000">'; echo'<tr>'; echo'<th scope="col" bgcolor="#66FFFF">Sale No</th>'; echo'<th scope="col" bgcolor="#66FFFF">Category</th>'; echo'<th scope="col" bgcolor="#66FFFF">Brand</th>'; echo'<th scope="col" bgcolor="#66FFFF">Quantity </th>'; echo'<th scope="col" bgcolor="#66FFFF">Paid By: </th>'; echo'<th scope="col" bgcolor="#66FFFF">Amount </th>'; echo'<th scope="col" bgcolor="#66FFFF">Date of Sale </th>'; echo'</tr>'; while($row = dbFetchArray($result)) { echo'<tr>'; echo'<td align="center">'; $SaleID = $row["SaleID"]; echo $SaleID. "<br>"; echo'</td align="center">'; echo'<td align="center">'; $Category = $row["Category"]; echo $Category. "<br>"; echo'</td align="center">'; echo'<td align="center">'; $Brand = $row["Brand"]; echo $Brand. "<br>"; echo'</td align="center">'; echo'<td align="center">'; $Quantity = $row["Quantity"]; echo $Quantity. "<br>"; echo'</td align="center">'; echo'<td align="center">'; $PaidBy = $row["PaidBy"]; echo $PaidBy. "<br>"; echo'</td align="center">'; echo'<td align="center">'; $Cost = $row["Cost"]; echo $Cost. "<br>"; echo'</td align="center">'; echo'<td align="center">'; $SaleDate = $row["SaleDate"]; echo $SaleDate. "<br>"; echo'</td align="center">'; echo '</tr>'; } echo'</table>'; // echo 'Go back <a href="index.php">Here</a> for another search.'; } } ///////////////////////////// function salesbyCategory() { $byCategory = $_POST['sltCategory']; $sql = 'SELECT * FROM cstocksales WHERE Category = "'.$byCategory.'"'; $result = dbQuery($sql); ///$result = dbQuery(getPagingQuery($sql, $rowsPerPage)); //$pagingLink = getPagingLink($sql, $rowsPerPage); if (dbNumRows($result) == 0) //if none { echo '<p><font color=#CC0000><h4>No sales for the Category "'.$_POST['sltCategory'].'" were found in the records...</h4></font></p>'; echo 'Go back <a href="index.php">Here</a> for another search.'; } else { echo '<h5>"'.$_POST['sltCategory'].'" sales:<p></h5>'; echo '<table width="100%" border="1" bordercolor="#000000">'; echo'<tr>'; echo'<th scope="col" bgcolor="#66FFFF">Sale No</th>'; echo'<th scope="col" bgcolor="#66FFFF">Category</th>'; echo'<th scope="col" bgcolor="#66FFFF">Brand</th>'; echo'<th scope="col" bgcolor="#66FFFF">Quantity </th>'; echo'<th scope="col" bgcolor="#66FFFF">Paid By: </th>'; echo'<th scope="col" bgcolor="#66FFFF">Amount </th>'; echo'<th scope="col" bgcolor="#66FFFF">Date of Sale </th>'; echo'</tr>'; while($row = dbFetchArray($result)) { echo'<tr>'; echo'<td align="center">'; $SaleID = $row["SaleID"]; echo $SaleID. "<br>"; echo'</td align="center">'; echo'<td align="center">'; $Category = $row["Category"]; echo $Category. "<br>"; echo'</td align="center">'; echo'<td align="center">'; $Brand = $row["Brand"]; echo $Brand. "<br>"; echo'</td align="center">'; echo'<td align="center">'; $Quantity = $row["Quantity"]; echo $Quantity. "<br>"; echo'</td align="center">'; echo'<td align="center">'; $PaidBy = $row["PaidBy"]; echo $PaidBy. "<br>"; echo'</td align="center">'; echo'<td align="center">'; $Cost = $row["Cost"]; echo $Cost. "<br>"; echo'</td align="center">'; echo'<td align="center">'; $SaleDate = $row["SaleDate"]; echo $SaleDate. "<br>"; echo'</td align="center">'; echo '</tr>'; } echo'</table>'; echo 'Go back <a href="index.php">Here</a> for another search.'; } } function salesbyBrand() { $byBrand = $_POST['sltBrand']; $sql = 'SELECT * FROM cstocksales WHERE Brand = "'.$byBrand.'"'; $result = dbQuery($sql); ///$result = dbQuery(getPagingQuery($sql, $rowsPerPage)); //$pagingLink = getPagingLink($sql, $rowsPerPage); if (dbNumRows($result) == 0) //if none { echo '<p><font color=#CC0000><h4>No sales for the brand "'.$_POST['sltBrand'].'" were found in the records...</h4></font></p>'; echo 'Go back <a href="index.php">Here</a> for another search.'; } else { echo '<h5>"'.$_POST['sltBrand'].'" slaes:<p></h5>'; echo '<table width="100%" border="1" bordercolor="#000000">'; echo'<tr>'; echo'<th scope="col" bgcolor="#66FFFF">Sale No</th>'; echo'<th scope="col" bgcolor="#66FFFF">Category</th>'; echo'<th scope="col" bgcolor="#66FFFF">Brand</th>'; echo'<th scope="col" bgcolor="#66FFFF">Quantity </th>'; echo'<th scope="col" bgcolor="#66FFFF">Paid By: </th>'; echo'<th scope="col" bgcolor="#66FFFF">Amount </th>'; echo'<th scope="col" bgcolor="#66FFFF">Date of Sale </th>'; echo'</tr>'; while($row = dbFetchArray($result)) { echo'<tr>'; echo'<td align="center">'; $SaleID = $row["SaleID"]; echo $SaleID. "<br>"; echo'</td align="center">'; echo'<td align="center">'; $Category = $row["Category"]; echo $Category. "<br>"; echo'</td align="center">'; echo'<td align="center">'; $Brand = $row["Brand"]; echo $Brand. "<br>"; echo'</td align="center">'; echo'<td align="center">'; $Quantity = $row["Quantity"]; echo $Quantity. "<br>"; echo'</td align="center">'; echo'<td align="center">'; $PaidBy = $row["PaidBy"]; echo $PaidBy. "<br>"; echo'</td align="center">'; echo'<td align="center">'; $Cost = $row["Cost"]; echo $Cost. "<br>"; echo'</td align="center">'; echo'<td align="center">'; $SaleDate = $row["SaleDate"]; echo $SaleDate. "<br>"; echo'</td align="center">'; echo '</tr>'; } echo'</table>'; echo 'Go back <a href="index.php">Here</a> for another search.'; } } ?>
I hope I provided clear information...