Re: Changing over to finishing the search engine

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Mar 12, 2011 at 2:07 PM, Bill Mudry <billmudry@xxxxxxxxxx> wrote:
> For now, I thank those helping me with the strange absence of some UV photos
> when others
> were showing. The problem still exists, so I will get back to it again on
> another day when some
> matters of greater priority are taken care of.
>
> The highest priority of unfinished programming tasks for my TAXA site is
> finishing the search
> engine. There are 4 organizational levels for the wood data but probably 95%
> of any queries
> or interest in the site will be at the species level, the level that defines
> all woods and at which
> the public can relate. It is only those academically minded who would show
> interest in the
> higher botanical levels. Therefore the search engine I have been working on
> is being designed
> to work only on different columns of one table, the 'species' table. All
> relevant pages and
> query reports are dynamically formed.
>
> Once completed, it will totally make access to the huge amount of data far
> more user friendly
> and versatile and become a key cornerstone for the operation of the website.
>
> I am no ace at PHP, more like slow but determined. This has been the most
> challenging code
> I, personally, have had to work on. I started via a simple, one column, one
> table search
> template from www.designplace.org. Mid stream in my efforts, I designed a
> way to let users
> choose what type of search (what column, actually) they wish to use.
> Recently I was able to
> combine that function into the search form successfully.
>
> All search categories work successfully ---- but at present, only the first
> page of a query.
> Page control is accomplished through two PHP_SELF statements, one to advance
> to the next
> page (until the end of the report is finished) and the other to go back a
> page. At one point,
> I had the forward action working right to the last page of a query. Now
> neither the page advancement nor the page reversing now works past the first
> page being reported ---- and I am not sure what I messed up ;-( :-[ . After
> getting the first page showing, pressing either the previous or next button
> brings out the following preprogrammed statements of:
>
> Â Â Â ÂSorry, your search: "Pterocarpus" returned zero results Â(from a
> genus search)
> Â Â Â ÂCouldn't execute query
>
> However, it does not put out a standard PHP error.
>
> If I can get these forward and reverse page actions to work, I expect that
> the job will be
> complete! In case this helps, the two PHP_SELF statements are on lines 478
> and 529.
> I will list the code for the whole page. There is copious internal
> documentation and many
> "debug" statements to help follow parameter values.
>
> Because of the uncommented debug statements, you can use the actual search
> page to
> follow values .... at:
> Â Â Â Âhttp://www.prowebcanada.com/taxa/commonname_search.php
>
> Much thanks for any help you can give,
>
> Bill Mudry
> Mississauga, Ontario Canada
>
>

Bill,

Before I dissect your code, you should follow the suggestions in the
php.ini file as per environment.  If you're coding on a development
box which you should be doing any way, then set the below settings
accordingly to increase your coding speed and reduce debugging time.

1) What's the error_reporting set to?
2) What's the value of display_errors?

=====================================================================
>
> [CODE]
> <?php
> //session_start(); // start up your PHP session!
>
>
> Â Â Â Â//$record_counter= @$_GET[$record_counter];
> Â Â Â Â//$record_counter = $_SESSION['$record_counter']; Â// Not used now.
> Â Â Â ÂECHO "\$record_counter on line 7 is $record_counter<br />";
> Â Â Â Â$count = $record_counter+1;
>
> Â Â Â Â//$count = $_SESSION['$count'];
>
> Â Â Â ÂECHO "\$count at the top, line 12 is - $count<br />";
>
> //$_SESSION['$count'] = $count;
> ?>
>
>
> <HTML>
> <HEAD>
> <!---
> ############################################################################################
> This page contains the major search functions for The TAXA Wood Knowledge
> Base.
> The file is commonname_search.php.
> It is called from the main menu.
> Important parameters include:
> Â Â Â Â$searchtype - is the method users choose to do a search as the
> English words
> Â Â$searchfield - Each method translates into the actual field in the
> 'species' table
> Â Â Â Â Â Â Â Â Â Â Â Â Â used to complete the query
> Â Â Â Â$querystring - is the actual query string submitted by the user.
> Â Â$record_counter is the record counter for the last record of the present
> page. First appears in line 146
> Â Â Â Â$newquerystring - The new query string value fom the form by using
> $_GET[]
> Â Â Â Â$limit - The allowed number of records reported before starting a new
> page
> Â Âconnecttotaxa.php - holds the values needed to connect to the taxa
> database
> Â Â Â Â$searchfield - The variable to indicate what field to search on.
> Right now there is only one,
> Â Â Â Â Â Â Â Â Â Â Â Âbut coding has already been worked out for letting
> users choose from a list of
> Â Â Â Â Â Â Â Âcolumns. To be added in the next version
> Â Â Â Â$$numrows - The total number of rows in the present query result
> Â Â$count - is the lower record number in the next upcoming page (if one is
> needed)
> Â Â Â Â Â Â Â ÂIt will always be one more than $record_counter which holds
> the highest record number for the
> Â Â Â Â Â Âcuurent page.
> Â Â Â Â$currPage - Calculates the current page number.
> Â Â Â Â$Page - Like $currPage. I am not sure yet what the relationship
> between them is.
> Â Â Â Â$remainder - The query shows in blocks of $limit records. If the
> total number of records
> Â Â Â Â Â Â Â Âto report is divided by the block size ($limit) and there is
> a remainder, then
> Â Â Â Â Â Âa new page needs to be started to finish off the last records in
> the report.
> Â Â Â Â$news - Is the highest record number to use for the next page.
> (..... or this is what I interpreted so far).
>
> This search engine was adapted from the template search engine at
> Â Â Â Âhttp://www.designplace.org/scripts.php?page=1&c_id=25
> ############################################################################################
> --->
>
>
>
> <TITLE>TAXA: Multicolumn Search</TITLE>
> <META name="Template author" content="Steve R, http://www.designplace.org/";>
> <META name="Bill Mudry" Content="TAXA Wood Knowledge Base web designer and
> author">
> <STYLE type="text/css">
> Â Â Â Âbody {
> Â Â Â Â Â Â Â Âbackground-color:'ivory'; color: 'navy'; font-family:
> verdana, arial, sans-serif; font-size: 12px;
> Â Â Â Â Â Â Â Â}
> Â Â Â Â.smalltext {font-size: 10px;}
> Â Â Â Â.mediumtext {font-size: 13px;}
> Â Â Â Â.largertext {font-size: 1.5em};
> Â Â Â Â.reportheader {font-size: 20px; font-weight:700;}
>
> Â Â Â Âtd {font-size:0.8em; background-color: '#EFDFCF'}
>
> Â Â Â ÂH1 {font-size:2em}; Â/* displayed at 24px */
> Â Â Â ÂH2 {font-size:1.5em}; Â/* displayed at 18px */
> Â Â Â ÂH3 {font-size:1.25em}; Â/* displayed at 15px */
> Â Â Â ÂH4 {font-size:1em}; Â/* displayed at 12px */
>
> Â Â Â Â#formbox {float: left; border:3px dotted
> red;background-color:"skyblue";}
>
> </STYLE>
>
> </HEAD>
> <!-- ÃÂ http://www.designplace.org/ (For the template used to start this
> design) -->
>
> <!--
> =========================================================================================
> XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX END OF HEADER
> ÂXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
>
> XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX START OF BODY
> ÂXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
> =========================================================================================
> -->
>
> <BODY>
>
> Â<?php
>
> Â Â Â Â//parse_str($_SERVER['QUERY_STRING'], $qs);
> Â Â Â Â//$record_counter =$qs['record_counter'];
>
> Â Â Â Â//$record_counter = 14; hard coded as a debug statement
>
> Â//ECHO "\$count on line 99 is - $count<BR />"; //debug statement
>
> ÂECHO "\$record_counter on line 95 is - $record_counter<BR />"; //debug
> statement
> Â?>
>
> <H2 align="center">Multi Column Search</H2>
>
> <DIV id="formbox">
>
> <?php
> //querystring ="";
> //$querystring ="";
>
> Â$newsearch = 0 ; //Equals 1 only on a new search request
> Â//ECHO "<p align=left>\$newsearch on line 111 is $newsearch</p>";
> Â$submit="";
> Â//ECHO "\Ssubmit, before the form, on line 113 is - $submit<br />";
> ÂIf ($submit) {$record_counter = 0;}
> ?>
>
> <!--
> =========================================================================================
> XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX MAIN FORM STARTS HERE
> ÂXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
> =========================================================================================
> -->
>
> <FORM name="form" action="commonname_search.php" method="get">
>
> <!-- ADD A TRANPARENT INSIDE TABLE TO ORGANIZE PLACEMENT OF ALL THE FORM
> ELEMENTS -->
> Â Â Â Â<TABLE align='center' border='0' bgcolor='ivory' cellpadding='6'>
> Â Â Â Â Â Â<TR>
> Â Â Â Â Â Â<TD align="center" colspan="5">
> Â Â Â Â Â Â<SPAN class="reportheader">Choose which search type you want
> first</SPAN>
> Â Â Â Â Â Â</TD>
> Â Â Â Â</TR>
> Â Â Â Â<TR>
> Â Â Â Â Â Â Â Â<TD class="mediumtext">
> Â Â Â Â Â Â Â Â<B>Common names</B>
> Â Â Â Â Â Â Â Â<Input type='radio' value='common names' name="searchtype" />
> Â Â Â Â Â Â Â Â</TD>
> Â Â Â Â Â Â Â Â<TD class="mediumtext">
> Â Â Â Â Â Â Â Â<B>Botanical names</B>
> Â Â Â Â Â Â Â Â<Input type='radio' value='botanical names' name="searchtype"
> />
> Â Â Â Â Â Â Â Â</TD>
> Â Â Â Â Â Â Â Â<TD class="mediumtext">
> Â Â Â Â Â Â Â Â<B>Genus</B>
> Â Â Â Â Â Â Â Â<Input type='radio' value='genus' name="searchtype" />
> Â Â Â Â Â Â Â Â</TD>
> Â Â Â Â Â Â Â Â<TD class="mediumtext">
> Â Â Â Â Â Â Â Â<B>Location</B>
> Â Â Â Â Â Â Â Â<Input type='radio' value='location' name="searchtype" />
> Â Â Â Â Â Â Â Â</TD>
> Â Â Â Â Â Â Â Â<TD class="mediumtext">
> Â Â Â Â Â Â Â Â<B>Description</B>
> Â Â Â Â Â Â Â Â<Input type='radio' value='description' name="searchtype" />
> Â Â Â Â Â Â Â Â</TD>
> Â Â Â Â</TR>
> Â Â Â Â<TR>
> Â Â Â Â Â Â Â Â<TD align="center" colspan="5" class="mediumtext">
> Â Â Â Â Â Â Â Â Â Â Â Â<B>Enter a Search String:</B>&nbsp;
>
> Â Â Â Â Â Â Â Â<INPUT type="text" size="40" name="querystring"
> />&nbsp;&nbsp;&nbsp;
> Â Â Â Â Â Â Â Â Â Â Â Â<INPUT type="hidden" name="newsearch" value="1">
> Â Â Â Â Â Â Â Â Â Â Â Â<INPUT type="submit" name="submit" value="Start
> Search" />
> Â Â Â Â Â Â Â Â Â Â Â Â</TD>
> Â Â Â Â Â Â Â Â</TR>
> Â Â Â Â</TABLE>
>
> </FORM>
> </DIV>
>
> <!--
> =========================================================================================
> XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX MAIN FORM STOPS HERE
> ÂXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
> =========================================================================================
> -->
>
> <?php
>
> $submit = $_GET["submit"];
> ECHO "\$submit on line 179 is - $submit<br />";
>
> $newsearch = $_GET["newsearch"];
> //ECHO "\$newsearch just past the form on line 180 is - $newsearch<br />";
>
> IF ($newsearch=1) {$record_counter=0;};
> ECHO "\$record_counter on line 185 is - $record_counter<br />";
> /*
> ===========================================================================
> XXXXXXXXXXX GET THE SEARCH TYPE AND SEARCH STRING FROM THE FORM XXXXXXXXXXX
> ===========================================================================
> */
> Â Â Â Â$searchtype = $_GET['searchtype'] ;
> Â Â Â Â$searchtype = trim($searchtype); //trim whitespace from the stored
> variable
>
> Â Â Â Â//ECHO "On line 192, \$searchtype is - $searchtype<br />"; // Debug
> statement
>
> Â Â Â Â$querystring = @$_GET['querystring'] ;
> Â Â Â Â$querystring = trim($querystring); //trim whitespace from the stored
> variable
>
> Â//
> =====================================================================================
> Â Â Â Â// REASSURE USER OF THEIR CHOICES. (ALSO GOOD FOR DEBUGGING).
> Â Â Â ÂIf (!empty($searchtype))
> Â Â Â Â Â Â Â Â{
> Â Â Â Â Â Â Â Â Â Â Â ÂECHO "<h3 align='center'>searching under $searchtype
> for: &quot;" . $querystring . "&quot;</h3>";
> Â Â Â Â Â Â Â Â}
>
> Â Â Â Â Â Â Â Â//ECHO "Line 204 - \$searchtype is - $searchtype<br />";
> //debug statement
> /*
> ===============================================================================
> XXXXXXXXXXXXXXXXX ÂTRANSLATION OF SEARCH TYPE TO COLUMN NAME
> ÂXXXXXXXXXXXXXXXXX
> ===============================================================================
> */
>
> $searchfield = "";
> Â Â Â Â//ECHO "Line 196 - \$searchtype is - $searchtype<br />"; // Debug
> statement
>
> Â Â Â Âswitch ($searchtype) {
> Â Â Â Â Â Â Â Âcase "common names":
> Â Â Â Â Â Â Â Â Â Â Â Â$searchfield = trim("species_commonname");
> Â Â Â Â Â Â Â Â Â Â Â Â//ECHO "<br>common names - $searchfield<br>\n";
> Â Â Â Â Â Â Â Â Â Â Â Âbreak;
> Â Â Â Â Â Â Â Âcase "botanical names":
> Â Â Â Â Â Â Â Â Â Â Â Â$searchfield = trim("species_name");
> Â Â Â Â Â Â Â Â Â Â Â Â//ECHO "<br>botanical names - $searchfield <br>\n";
> Â Â Â Â Â Â Â Â Â Â Â Âbreak;
> Â Â Â Â Â Â Â Âcase "genus":
> Â Â Â Â Â Â Â Â Â Â Â Â$searchfield = trim("genus_name");
> Â Â Â Â Â Â Â Â Â Â Â Â//ECHO "<br>genus - $searchfield <br>\n";
> Â Â Â Â Â Â Â Â Â Â Â Âbreak;
> Â Â Â Â Â Â Â Âcase "location":
> Â Â Â Â Â Â Â Â Â Â Â Â$searchfield = trim("location");
> Â Â Â Â Â Â Â Â Â Â Â Â//ECHO "<br>location - $searchfield <br>\n";
> Â Â Â Â Â Â Â Â Â Â Â Âbreak;
> Â Â Â Â Â Â Â Âcase "description":
> Â Â Â Â Â Â Â Â Â Â Â Â$searchfield = trim("species_description");
> Â Â Â Â Â Â Â Â Â Â Â Â//ECHO "<br>description - $searchfield <br>\n";
> Â Â Â Â Â Â Â Â Â Â Â Âbreak;
> Â Â Â Â Â Â Â Âdefault: If (!isset($searchfield)) {
> Â Â Â Â Â Â Â Â Â Â Â ÂECHO "Please choose a search type first";
> Â Â Â Â Â Â Â Â}
> Â Â Â Â}
> /*
> ===============================================================================
> XXXXXXXXXXXXX END OF TRANSLATION OF SEARCH TYPE TO COLUMN NAME
> ÂXXXXXXXXXXXXXX
> ===============================================================================
> */
>
>
> Â// Get the search variable from URL. Old designations were $var =
> @$_GET['q'] ;
>
> Â$newquerystring = @$_GET['querystring'] ;
> Â$querystring = trim($newquerystring); //trim whitespace from the stored
> variable
>
> Â Â Â Â$count = $record_counter +1;
> Â$newsearch = @$_GET['newsearch'] ;
> ÂECHO "\$newsearch on line 255 is $newsearch";
>
> Âif ($newsearch > 0) {$record_counter=0;};
>
>
> Â/*=====================================================================
> Â Â Â ÂXXXXXXXXXXXXX SET THE NUMBER OF RECORDS PER PAGE HERE ÂXXXXXXXXXXXXXX
>
> Â=====================================================================*/
> Â Â Â Â$limit='30';
>
> // check for an empty string and display a message.
> if ($querystring == "")
> Â{
> ÂECHO "<p align='center'>Please enter a search string...</p>";
> Âexit;
> Â}
>
> // check for a search parameter
> if (!isset($newquerystring))
> Â{
> ÂECHO "<p align='center'>We dont seem to have a search parameter!</p>";
> Âexit;
> Â}
>
> /*=========================================================================================
> ÂXXXXXXXXXXXXXXXXXXXXXXXXXXX Connect to the TAXA Database
> ÂXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
> Â=========================================================================================*/
>
> include ("connecttotaxa.php");
> $connection = mysql_connect($hostname, $username, $password)
> Â Â Â Âor die("Unable to connect to database server");
>
>
> //specify database ** EDIT REQUIRED HERE **
> mysql_select_db("taxa") or die("Unable to select the TAXA database");
> //select which database we're using
>
>
> /*=========================================================
> ÂXXXXXXXXXXXXXXX BUILD THE SQL QUERY ÂXXXXXXXXXXXXXXXXXXXX
> =========================================================*/
>
> // Build SQL Query
> $searchquery = "SELECT *
> FROM species
> WHERE $searchfield like \"%$querystring%\"
> Âorder by '$searchfield'";
>
> Â$numresults=mysql_query($searchquery);
>
>
> Â@$numrows=mysql_num_rows($numresults);
>
> /*===============================================================================================
> ÂXXXXXXXXXXXXXXX TEST FOR ZERO RESULTS AND PRINT A MESSAGE OF THAT IF TRUE
> ÂXXXXXXXXXXXXXXXXXXXX
> ================================================================================================*/
> if ($numrows == 0)
> Â{
> ÂECHO "<h3 align='center'>Search Results</h3>";
> ÂECHO "<p align='center'>Sorry, your search: &quot;" . $querystring. "&quot;
> returned zero results</p>";
> Â}
>
> /*=========================================================
> // $record_counter is the record counter for the present record
> // next determine if s has been passed to script, if not use 0
> =========================================================*/
>
> Âif (empty($s)) {
> Â$record_counter=0;
> Â}
>
> /*===========================================================================
> ÂXXXXXXXXXXXXXXX QUERY THE DATABASE TO GET THE RESULTS ÂXXXXXXXXXXXXXXXXXXXX
> ===========================================================================*/
>
> // get results
> Â$searchquery .= " limit $record_counter,$limit";
> Â$result = mysql_query($searchquery) or die("Couldn't execute query");
>
> /*=========================================================================================
> ÂXXXXXXXXXXXXXXX ECHO BACK TO THE USER WHAT THEY ASKED TO SEARCH FOR
> ÂXXXXXXXXXXXXXXXXXXXX
> =========================================================================================*/
> ECHO "<p align='center'>You searched for: &quot;" . $querystring .
> "&quot;</p>";
>
> /////////////////////////////////////////////////////////////////
> // Â Â Â Â Â********** REPORTING STARTS HERE Â********** Â Â Â //
> /////////////////////////////////////////////////////////////////
>
> /*================================================================
> ÂXXXXXXXXXXXXXXX SET A TITLE FOR THE REPORT ÂXXXXXXXXXXXXXXXXXXXX
> ================================================================*/
> ECHO "<H3 align='center'>Search Results - $numrows references found.<br
> /><br /></H3>";
>
> // now you can display the results returned
>
> /*==========================================================================
> ÂXXXXXXXXXXXXXXX SET UP COLUMN HEADERS FOR THE REPORT ÂXXXXXXXXXXXXXXXXXXXX
> ==========================================================================*/
>
> ECHO "<table align='center' border=0 cellpadding=3 Cellspacing=0
> bgcolor='white'>";
> ECHO "<tr colspan=3>";
> Â Â Â ÂECHO "<td bgcolor='#EFDFCF' class=\"reportheader\">";
> Â Â Â Â Â Â Â Â//ECHO "<span>Common Name</span>";
> Â Â Â Â Â Â Â ÂECHO "Common Name";
> Â Â Â ÂECHO "</td>";
>
> Â Â Â ÂECHO "<td bgcolor='#EFDFCF' class=\"reportheader\">";
> Â Â Â Â Â Â Â ÂECHO "Botanical Name";
> Â Â Â ÂECHO "</td>";
>
> Â Â Â ÂECHO "<td bgcolor='#EFDFCF' class=\"reportheader\">";
> Â Â Â Â Â Â Â ÂECHO "Authorities";
> Â Â Â ÂECHO "</td>";
>
> Â Â Â ÂECHO "<td bgcolor='#EFDFCF' class=\"reportheader\">";
> Â Â Â Â Â Â Â ÂECHO "Genus Name";
> Â Â Â ÂECHO "</td>";
>
> Â Â Â ÂECHO "<td bgcolor='#EFDFCF' class=\"reportheader\">";
> Â Â Â Â Â Â Â ÂECHO "Location";ECHO "</td>";
>
> Â Â Â ÂECHO "<td bgcolor='#EFDFCF' class=\"reportheader\">";
> Â Â Â Â Â Â Â ÂECHO "Comments";
> Â Â Â ÂECHO "</td>";
>
> Â Â Â Âif (!isset($count)){$count=1;};
>
> ECHO "</tr>";
> ECHO "<tr>";
>
>
>
>
>
> /*========================================================
> ÂXXXXXXXXX ÂPRINT OUT RECORDS TILL END OF QUERY XXXXXXXXX
>
> Â************** WHILE LOOP STARTS HERE ******************
> ========================================================*/
> Âwhile ($row= mysql_fetch_array($result)) {
> Â$commonname = $row["species_commonname"];
> Â$botname = $row["species_name"];
> Â$authorities = $row["authorities_species"];
>
> Â$genusname = $row["genus_name"];
> Â$location = $row["location"];
> Â$comments = $row["comments"];
>
> Â Â Â ÂECHO "<td valign='top' class=smalltext;>";
> Â Â Â Â//ECHO "\$count is $count<br />";
>
> Â Â Â ÂECHO "$count &nbsp; $commonname<br />" ;
> Â Â Â ÂECHO "</td>";
>
> Â Â Â ÂECHO "<td valign='top' class=smalltext;>";
> Â Â Â ÂECHO "<a href=\"displayspecies.php?&species_name=$botname \">";
> Â Â Â ÂECHO "$botname<br />";
> Â Â Â ÂECHO "</a><br>\n";
>
> Â Â Â ÂECHO "</td>";
> Â Â Â ÂECHO "<td valign='top' class=smalltext;>";
> Â Â Â ÂECHO "$authorities<br />";
> Â Â Â ÂECHO "</td>";
>
> Â Â Â ÂECHO "<td valign='top' class=smalltext;>";
> Â Â Â ÂECHO "$genusname<br />";
> Â Â Â ÂECHO "</td>";
>
> Â Â Â ÂECHO "<td valign='top' class=smalltext;>";
> Â Â Â ÂECHO "$location<br />";
> Â Â Â ÂECHO "</td>";
>
> Â Â Â ÂECHO "<td class=smalltext;>";
> Â Â Â ÂECHO "$comments<br />";
> Â Â Â ÂECHO "</td>";
>
> Â Â Â ÂECHO "</tr>";
> Â Â Â ÂECHO "<tr>";
>
> Â$count++ ;
> Â$record_counter++ ; // DOESN'T $record_counter HAVE TO BE INCREMEENTED FOR
> EACH ROW PRINTED ALSO??
> Â// ANOTHER COPY WORKED A FEW MONTHS AGO WITHOUT IT. iT IS NOT IN THE
> TEMPLATE.
> Â//ECHO "\$record_counter on line 412 is - $record_counter<BR />"; //debug
> statement
> Â}
>
>
> /*========================================================
> ÂXXXXXXXXX ÂEND OF WHILE LOOP. XXXXXXXXX
> ========================================================*/
>
> ////////////////////////////////////////////////////////////
> // Â Â CLOSE THE REPORT TABLE
> ////////////////////////////////////////////////////////////
> ECHO "</tr>";
> ECHO "</table>";
> ECHO "<BR />";
> ECHO "\$record_counter on line 436 at the end of the report loop is -
> $record_counter<br />";
>
>
>
> // Calculate the current page
> $currPage = (($record_counter/$limit) + 1);
> $pages = $currPage; //
> ECHO "\$currPage on line 451 is - $currPage<br />"; //debug statement
> ECHO "\$record_counter on line 452 is - $record_counter<BR />"; //debug
> statement
>
> //break before paging
> ÂECHO "<br />";
>
> Â// next we need to do the links to other results
>
> //////////////////////////////////////////////////////////////////////
> // If $record_counter is less than 1, there are no more records to view
> backwards.
> //////////////////////////////////////////////////////////////////////
>
> // bypass PREV link if s is 0 since there must be at least one more record
> to display to use a new page.
> if ($record_counter>=1) {
> ÂECHO "\$record_counter at line 453 is - $record_counter<br /> "; //debug
> statement
> Â$prevs=($record_counter-$limit);
> Â Â Â Â ÂECHO "\$prevs at line 455 is - $prevs<br /> "; //debug statement
>
> //////////////////////////////////////////////////////////////////////////////////////////////
> // Â Â****** This statement will run the prior page of the report. It is
> user chosen******
> //
> //////////////////////////////////////////////////////////////////////////////////////////////
> Âprint "&nbsp;<a
> href=\"$PHP_SELF?record_counter=$prevs&querystring=$querystring&searchfield=$searchfield\">

I don't see $PHP_SELF declared prior to usage.  Having the proper
development settings in php.ini will show you this error.  Here I
think you meant $_SERVER['PHP_SELF'].  See
http://php.net/reserved.variables.

It's recommended to use $_SERVER['SCRIPT_NAME'] over $_SERVER['PHP_SELF'].

> Â<p align='left' class='largertext'><b>&lt;&lt; Previous $limit
> records</b></p></a>&nbsp&nbsp;"; // Page 357
>
> } Â //END OF PRESENT IF STATEMENT
>
> // calculate number of pages needing links
> Â$pages=intval($numrows/$limit);
>
> //ECHO "\$pages on line 469 is - $pages<br />"; //debug statement
> //ECHO "\$numrows on line 470 is - $numrows<br />"; //debug statement
> //ECHO "\$limit on line 471 is - $limit<br />"; //debug statement
>
> // $pages now contains int of pages needed unless there is a remainder from
> division
>
> Âif ($numrows%$limit) {
> Â// has remainder so add one page
> Â$pages++;
> Â}
> //ECHO "\$pages on line 479 is - $pages<br />"; //debug statement
>
> $remainder = ($numrows%$limit);
> //ECHO "\$remainder on line 353 is - $remainder<br />"; //debug statement
>
> ÂECHO "<br />";
>
> Â Â Â Â//$x = ($record_counter+$limit)/$limit
> Â Â Â Â//ECHO "\$x on line 478 is - $x<br />"; //debug statement
> Â Â Â ÂECHO "\$record_counter on line 479 is - $record_counter<br />";
> //debug statement
>
> Â Â Â Â//ECHO "\$limit on line 490 is - $limit<br />"; //debug statement
> Â Â Â Â//ECHO "\$pages on line 491 is - $pages<br />"; //debug statement
>
> // check to see if last page
> Âif (!((($record_counter+$limit)/$limit)==$pages) && $pages!=1) {
>
> ÂECHO "<br />";
>
> Â// not last page so give NEXT link
> Â$news=$record_counter+$limit;
> Â Â Â ÂECHO "\$record_counter on line 517 is - $record_counter<br />";
> //debug statement
> Â Â Â Â//ECHO "\$limit on line 492 is - $limit<br />"; //debug statement
> Â Â Â Â//ECHO "\$news on line 493 is - $news<br />"; //debug statement
> Â Â Â Â//ECHO "<div align='right' style='color:'#FF0000'>";
>
> ////////////////////////////////////////////////////////////
> // ÂThis statement will run the next page of the report.
> // ÂIt is user chosen
> ////////////////////////////////////////////////////////////
>
> //echo "&nbsp;<a href=\"$PHP_SELF?s=$news&q=$var\">Next 10 &gt;&gt;</a>";
>

Again, see the above.

> ECHO "&nbsp;<a
> href=\"$PHP_SELF?record_counter=$news&querystring=$newquerystring&searchfield=$searchfield\">
> <p class='largertext' aligm='right'><B>Next $limit records
> &gt;&gt;</b></p></a>";
>
> Â Â Â ÂECHO "</div>";
> Â}
> Â Â Â ÂECHO "\$record_counter on line 534 is - $record_counter<BR />";
> //debug statement
>
> Â Â Â Â$record_counter = $news;
>
> Â Â Â ÂECHO "\$record_counter on line 538 is - $record_counter<BR />";
> //debug statement
>
> //$_SESSION['$record_counter'] = $record_counter;
> //$_SESSION['$count'] = $count;
>
> ?>
>
> <!-- Ãâàhttp://www.designplace.org/ -->
>
> </BODY>
> </HTML>
>
>
> [/CODE]
>
>

One more thing, consider using pastebin.com for code posting.  Doing
in the emails is very bad for legibility (due to line wrapping) and no
line numbers when you reference line number in describing your
problem,  especially on a long post like yours.

Regards,
Tommy



[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux