Getting rid of bugs I never thought I would have

Getting rid of bugs I never thought I would have

am 25.06.2010 03:16:21 von Bill Mudry

--=====================_111260568==.ALT
Content-Type: text/plain; charset="us-ascii"; format=flowed

Overall, I am happy with the progress on my pet TAXA project but the
journey is proving to be like riding over a rocky road. The most
recent effort at a functional addition has been a form to let users
decide whether 2 of three types of data will show (general,
woodworking & numeric). The general
data for each wood should always so and the users should be able to
choose if either or both of hte other two should show (using include files).

At first in the form's simplest unformatted form, I got it working
fine (and I rejoiced ....). Then when I tried to put it into a table
to pretty it up again --- I would no longer work (... almost). I
tried all kinds of things. If you temporarily hardcode the choices,
the two tables show or do not as desired. Somehow
the user choices are not latching to the control lines. Every time
you click on the submit button
(named ''Choose Data to View"), it cycles back to the same page like it should.

Now the weird things start. Yesterday, in reviewing everything before
submitting to this forum, I
decided I should try it again ---- and to my astonishment for a while
--- it worked! I could choose
the working data checkbox, the woodworking checkbox or both and they
would show. Don't
check either and they didn't show just like should be. That was short
lived, though(!). It hasn't
worked since. Ahem..... talk about flaky.....

But then I noticed another problem. To activate the user choice you
have to click on the submit button of course. When I cycled through
is when I noticed that now on species detail sheets that
are set up to show a scan of the wood being reported on the scan that
first showed disappears,
leaving only the 'missing' graphic' symbol only.

So now I have two consternating problems:

1 - How do I get the form to let users choose what data
tables to show to work consistently
well all the time? If it works mysteriously some of the
time, my code should be fairly
close to what it needs to be .

2 - How do I keep the scan showing always? I realize that
each time the submit button is
hit, the location for what scan file (all .jpg) should
show gets lost. All scans are kept in
and alphabetical list of folders according to the first
letter of the (botanical) name of the wood being showed:
/taxa/wood_scans/gallery_a/
/taxa/wood_scans/gallery_b/
/taxa/wood_scans/gallery_c/
/taxa/wood_scans/gallery_d/ and so on, but have been loaded into
the 'species' MySQL file (species.sql) also in
column 'picture_filename'.

I looked at various examples on the Net but could not
see why it won't consistently work.
Probably the best way to understand what is happening is to try out
the site. You can find it at (as before) www.prowebcanada.com/taxa.
On the left side menu under 'Woods by Alphabet", use the
menu choice 'Woody Species'. Pick a name with a camera icon in front
of it in the range of A,B or C
where there is more data for now). It doesn't matter whether or not
you use the alphabetical menu first.

As long as you picked a species with a camera beside it, you should
see a scan of what that wood
looks like --- as long as you have not yet used the user choice form
below the Genera Data table. Now try picking if you want either the
woodworking data and/or Numeric Data tables to show. Click
the submit button and notice it does recycle ok ---- but it is a
minor miracle if the tables really do
show. Meanwhile, the graphic scan has disappeared

This time I think I had better show the code for the entire file :-(
.. All this is happening in file
'displayspecies.php'. There are many debugging commented lines you
can ignore ;-) .

Glad for the help,

Bill Mudry


======================= Code follows =======================================


//////////////////////////////////////////////////////////// //////////////////////////
// File: displayspecies.php
// Date last revision: May 26, 2010
// Description: Displays all details of a chosen species.
// Called by: displaygenera2.php
//
//
//////////////////////////////////////////////////////////// //////////////////////////

parse_str($_SERVER['QUERY_STRING'], $qs);
$species_name=$qs['species_name'];

//$picture_filename1=$qs['picture_filename1'];


#
//////////////////////////////////////////////////////////// ////////////////////////
# CONNECT TO DATABASE
#
//////////////////////////////////////////////////////////// ////////////////////////

include ("connecttotaxa.php");
$connection = mysql_connect($hostname, $username, $password)
or die("Unable to connect to database server");

$db = mysql_select_db($dbname, $connection)
or die("Unable to connect to database");

/*
------------------------------------------------------------ --------------------
HOPEFULLY CONNECTED AT THIS POINT
------------------------------------------------------------ ----------------------

*/


$query6 = "SELECT * FROM species WHERE species_name='$species_name'";
//var_dump($query6);
$result6 = mysql_query($query6)
or die(mysql_error());

If ($result6)
{
$row6=mysql_fetch_array($result6, MYSQL_ASSOC);
// Echo "\$row6 is - $row6
\n";
Echo MYSQL_ERROR();

if ($row6){
$z=extract($row6); //Echo MYSQL_ERROR();
};

Echo "";
Echo "";

Echo "Data on a specific chosen botanical species <br /> $species_name" ;<br /> Echo "";
//Echo " ";

//////////////////////////////////////////////////////////// ///////////////////////////////
//
// START OF BODY
//
//////////////////////////////////////////////////////////// ///////////////////////////////

?>




bgcolor='antiquewhite' border='5' bordercolor='navy' width='800'>









The programming works well now but there is a lot of data to
be stored.
It is a huge job that will take a long time to get
most of it in. Till then, there may seem
to be a lot of data missing --- because there is!



This species area is still under development. It is the
bottom of the botanical tree.
No further elements are under species. There are
three categories for species data;
GENERAL DATA, WOODWORKING DATA AND NUMERIC TEST
DATA. General Data will always be
shown while future programming will let the reader
choose if woodworking or numeric test data shows.




Some species will have a lot of information for them, a few
even for all three data areas. The species that TAXA
reports ranges from massive wood from the largest trees in the
world weighing tons to ssmall shrubs that are
"woody" but without enough wood to be used for anything other
than academic interest. Some woods have been
researched and tested thoroughly while others are amongst the
thousands that are only known by some basic facts.
This shows why some data areas are rich with text and pictures
while others have very little known about them.
For such rare, obscure or small sized species, listing
woodworking or numeric test data is neither practical or
useful.



General Information

Basic information on wood any reader would want.
Always present.

Woodworking Information

Optional information on what a wood is like to use
and work with.

Of interest for anyone who will work with a wood.

Numeric Test Information

Optional information on lab test results.

Largely of interest to architects, engineers and
researchers. Data is less common.













echo "

Woody Species $species_name

";

echo "

Data on a chosen woody
species known under a chosen genus

";


//////////////////////////////////////////////////////////// //////////////////////////////////////////
//
Section to show scans
//////////////////////////////////////////////////////////// //////////////////////////////////////////
Echo "
";

//$picture_filename1 = $_GET[picture_filename1];

//Echo "START OF PICTURE AREA

";

// Echo "On line 141 \$picture_filename1 is -
$picture_filename1

";
$picture_path = "./wood_scans/$picture_filename1";
//Echo "\$picture_path is - $picture_path

";

//echo "
";

//Echo " Before if, \$picture_path is - $picture_path


If ($picture_path)
{echo "

";}
else echo "No picture

";

//(Echo "\$picture_path is - $picture_path



// Echo "
END OF PICTURE AREA

";

Echo "
//////////////////////////////////////////////////////////// //////////////////////////////////////////
// Start
of reporting general data.
//////////////////////////////////////////////////////////// //////////////////////////////////////////

Echo " border='2' bordercolor='saddlebrown' width='800'>";
Echo "";
Echo "";
Echo "";
Echo "";
Echo "";
Echo "";
Echo "";
Echo "";
Echo "";
Echo "";
Echo "";
Echo "";
Echo "";
Echo "";
Echo "";
Echo "";
Echo "";
Echo "";
Echo "";
Echo "";
Echo "";
Echo "";
Echo "";
Echo "";
Echo "";
Echo "";
Echo "";
Echo "";
Echo "";
Echo "";
Echo "";
Echo "";
Echo "";
Echo "";
Echo "";
Echo "";
Echo "";
Echo "";
Echo "";
Echo "";
Echo "";
Echo "";



Echo "

General Data for
Species $species_name

Authority - $authorities_speciesVarieties, cultivars, Hybrids, Subspecies -

\n $varieties
Common Names - $species_commonnameSynonyms - $syn_species
Gymnosperm or Angiosperm? $gymno_angioCommercial wood? - $commercial_wood
Uses - $species_usesDurability - $durability
Plant forms - $species_life_formTypical sizes of plant - $species_lifeform_size
Seasoning - $seasoningStability - . $stability
General Description -
$species_description
Typical Defects - $defects
Toxicity - $toxicity
World Distribution - $location
Comments - $comments


\n"; //Close off data table;

Echo "

";
}


//////////////////////////////////////////////////////////// //////////////////////////////////////////
//
// Let users decide if they wish to view woodworking
and/or numeric test data.
//
//////////////////////////////////////////////////////////// //////////////////////////////////////////

//$show_woodworking = "off";
//$show_numeric = "off";
?>

Choose if you wish to also view Woodworking or
Numeric Data














Show Woodworking Data


Show Numeric Test Data






////////////////////////////////////////////////////////
// END OF FORM, START OF PROCESSING USER INPUT
////////////////////////////////////////////////////////

//$display_working_data =""; // initialize responses to empty before
retrieving them
//$display_numeric_data ="";

//Echo "line 254 \$display_working_data is - $display_working_data ";
//Echo "
";
//Echo "line 256 \$display_numeric_data is - $display_numeric_data ";
//Echo "
";

//bring in user's answers from form:
//$display_working_data = $_GET['show_woodworking'];
//$display_numeric_data = $_GET['show_numeric'];

//check what user responses are:
//echo "Line 262 - \$display_working_data is - $display_working_data
";
//Echo "line 263 - \$display_numeric_data is - $display_numeric_data
";

if ($display_working_data) {
Echo "line 269 - \$display_working_data is - $display_working_data ";
Echo "
";
include "./woodworking_data.php";
}
else {
Echo "Working data chosen not to show

";
// echo "Line 274 - \$display_working_data is -
$display_working_data
";

};

// echo "working_data is - $display_working_data";

//Echo "line 282 - \$display_numeric_data is - $display_numeric_data ";


if ($display_numeric_data) {
Echo "line 284 - \$display_numeric_data is - $display_numeric_data ";
Echo "
";
include "./numeric_data.php";
}
else {Echo "Numeric data chosen not to show

";
};

//echo "numeric_data is - $display_numeric_data";

echo "
";

//include "./wood_data.php";

?>

END OF WOOD DATA REPORT







(I haven't added in the two include files since I have seen them work
ok when the form does work.).


--=====================_111260568==.ALT--

Re: Getting rid of bugs I never thought I would have

am 28.06.2010 22:14:55 von James Crow

On 06/24/2010 09:16 PM, Bill Mudry wrote:
> Overall, I am happy with the progress on my pet TAXA project but the
> journey is proving to be like riding over a rocky road. The most
> recent effort at a functional addition has been a form to let users
> decide whether 2 of three types of data will show (general,
> woodworking & numeric). The general
> data for each wood should always so and the users should be able to
> choose if either or both of hte other two should show (using include
> files).
>
> At first in the form's simplest unformatted form, I got it working
> fine (and I rejoiced ....). Then when I tried to put it into a table
> to pretty it up again --- I would no longer work (... almost). I tried
> all kinds of things. If you temporarily hardcode the choices, the two
> tables show or do not as desired. Somehow
> the user choices are not latching to the control lines. Every time you
> click on the submit button
> (named ''Choose Data to View"), it cycles back to the same page like
> it should.
>
> Now the weird things start. Yesterday, in reviewing everything before
> submitting to this forum, I
> decided I should try it again ---- and to my astonishment for a while
> --- it worked! I could choose
> the working data checkbox, the woodworking checkbox or both and they
> would show. Don't
> check either and they didn't show just like should be. That was short
> lived, though(!). It hasn't
> worked since. Ahem..... talk about flaky.....
>
> But then I noticed another problem. To activate the user choice you
> have to click on the submit button of course. When I cycled through is
> when I noticed that now on species detail sheets that
> are set up to show a scan of the wood being reported on the scan that
> first showed disappears,
> leaving only the 'missing' graphic' symbol only.
>
> So now I have two consternating problems:
>
> 1 - How do I get the form to let users choose what data tables
> to show to work consistently
> well all the time? If it works mysteriously some of the
> time, my code should be fairly
> close to what it needs to be .
>
> 2 - How do I keep the scan showing always? I realize that each
> time the submit button is
> hit, the location for what scan file (all .jpg) should
> show gets lost. All scans are kept in
> and alphabetical list of folders according to the first
> letter of the (botanical) name of the wood being showed:
> /taxa/wood_scans/gallery_a/
> /taxa/wood_scans/gallery_b/
> /taxa/wood_scans/gallery_c/
> /taxa/wood_scans/gallery_d/ and so on, but have been
> loaded into
> the 'species' MySQL file (species.sql) also in column
> 'picture_filename'.
>


1) Fix 2 and I think 1 will be more easily traced.
2) I did not see that you were keeping the species_name once the user
clicks on "Choose data to view." You could add a hidden input field that
saves the value and returns it to the script. Something like:
echo "";
Once the user clicks the button to select the data they want to view,
PHP has no idea what species they were viewing.

Thanks,
James


--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: Getting rid of bugs I never thought I would have

am 29.06.2010 01:42:49 von Bill Mudry

--=====================_83803627==.ALT
Content-Type: text/plain; charset="us-ascii"; format=flowed

At 04:14 PM 28/06/2010, you wrote:
>On 06/24/2010 09:16 PM, Bill Mudry wrote:
>>Overall, I am happy with the progress on my pet TAXA project but
>>the journey is proving to be like riding over a rocky road. The
>>most recent effort at a functional addition has been a form to let
>>users decide whether 2 of three types of data will show (general,
>>woodworking & numeric). The general
>>data for each wood should always so and the users should be able to
>>choose if either or both of hte other two should show (using include files).
>>
>>At first in the form's simplest unformatted form, I got it working
>>fine (and I rejoiced ....). Then when I tried to put it into a
>>table to pretty it up again --- I would no longer work (...
>>almost). I tried all kinds of things. If you temporarily hardcode
>>the choices, the two tables show or do not as desired. Somehow
>>the user choices are not latching to the control lines. Every time
>>you click on the submit button
>>(named ''Choose Data to View"), it cycles back to the same page
>>like it should.
>>
>>Now the weird things start. Yesterday, in reviewing everything
>>before submitting to this forum, I
>>decided I should try it again ---- and to my astonishment for a
>>while --- it worked! I could choose
>>the working data checkbox, the woodworking checkbox or both and
>>they would show. Don't
>>check either and they didn't show just like should be. That was
>>short lived, though(!). It hasn't
>>worked since. Ahem..... talk about flaky.....
>>
>>But then I noticed another problem. To activate the user choice you
>>have to click on the submit button of course. When I cycled through
>>is when I noticed that now on species detail sheets that
>>are set up to show a scan of the wood being reported on the scan
>>that first showed disappears,
>>leaving only the 'missing' graphic' symbol only.
>>
>>So now I have two consternating problems:
>>
>> 1 - How do I get the form to let users choose what data
>> tables to show to work consistently
>> well all the time? If it works mysteriously some of
>> the time, my code should be fairly
>> close to what it needs to be .
>>
>> 2 - How do I keep the scan showing always? I realize that
>> each time the submit button is
>> hit, the location for what scan file (all .jpg)
>> should show gets lost. All scans are kept in
>> and alphabetical list of folders according to the
>> first letter of the (botanical) name of the wood being showed:
>> /taxa/wood_scans/gallery_a/
>> /taxa/wood_scans/gallery_b/
>> /taxa/wood_scans/gallery_c/
>> /taxa/wood_scans/gallery_d/ and so on, but have been loaded into
>> the 'species' MySQL file (species.sql) also in
>> column 'picture_filename'.
>
>
>1) Fix 2 and I think 1 will be more easily traced.
>2) I did not see that you were keeping the species_name once the
>user clicks on "Choose data to view." You could add a hidden input
>field that saves the value and returns it to the script. Something like:
>echo "";
>Once the user clicks the button to select the data they want to
>view, PHP has no idea what species they were viewing.

That might be a good suggestion, James. I will try this shortly
tonight. I will let you know after.

Can you possibly figure out why the form is working so flaky, now? As
above, it worked when not in a table for formating (quite well at one
early point), basically has not worked except briefly one morning
(without any code change I know.....) and not since. I just checked
now and it doesn't work.
The URL at the top shows as
http://www.prowebcanada.com/taxa/displayspecies.php?show_woo dworking=OFF&show_numeric=OFF
and that is even after I have chosen both user check boxes on and
clicked on the submit button. Both should read on but both show OFF.


>Thanks,
>James

Here's hoping that you or someone can catch what I have not quite
coded correctly.

Bill




>--
>PHP Windows Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php
>

--=====================_83803627==.ALT--

Re: Getting rid of bugs I never thought I would have

am 29.06.2010 02:43:41 von Niel Archer

> At 04:14 PM 28/06/2010, you wrote:
> >On 06/24/2010 09:16 PM, Bill Mudry wrote:
> >>Overall, I am happy with the progress on my pet TAXA project but
> >>the journey is proving to be like riding over a rocky road. The
> >>most recent effort at a functional addition has been a form to let
> >>users decide whether 2 of three types of data will show (general,
> >>woodworking & numeric). The general
> >>data for each wood should always so and the users should be able to
> >>choose if either or both of hte other two should show (using include files).
> >>
> >>At first in the form's simplest unformatted form, I got it working
> >>fine (and I rejoiced ....). Then when I tried to put it into a
> >>table to pretty it up again --- I would no longer work (...
> >>almost). I tried all kinds of things. If you temporarily hardcode
> >>the choices, the two tables show or do not as desired. Somehow
> >>the user choices are not latching to the control lines. Every time
> >>you click on the submit button
> >>(named ''Choose Data to View"), it cycles back to the same page
> >>like it should.
> >>
> >>Now the weird things start. Yesterday, in reviewing everything
> >>before submitting to this forum, I
> >>decided I should try it again ---- and to my astonishment for a
> >>while --- it worked! I could choose
> >>the working data checkbox, the woodworking checkbox or both and
> >>they would show. Don't
> >>check either and they didn't show just like should be. That was
> >>short lived, though(!). It hasn't
> >>worked since. Ahem..... talk about flaky.....
> >>
> >>But then I noticed another problem. To activate the user choice you
> >>have to click on the submit button of course. When I cycled through
> >>is when I noticed that now on species detail sheets that
> >>are set up to show a scan of the wood being reported on the scan
> >>that first showed disappears,
> >>leaving only the 'missing' graphic' symbol only.
> >>
> >>So now I have two consternating problems:
> >>
> >> 1 - How do I get the form to let users choose what data
> >> tables to show to work consistently
> >> well all the time? If it works mysteriously some of
> >> the time, my code should be fairly
> >> close to what it needs to be .
> >>
> >> 2 - How do I keep the scan showing always? I realize that
> >> each time the submit button is
> >> hit, the location for what scan file (all .jpg)
> >> should show gets lost. All scans are kept in
> >> and alphabetical list of folders according to the
> >> first letter of the (botanical) name of the wood being showed:
> >> /taxa/wood_scans/gallery_a/
> >> /taxa/wood_scans/gallery_b/
> >> /taxa/wood_scans/gallery_c/
> >> /taxa/wood_scans/gallery_d/ and so on, but have been loaded into
> >> the 'species' MySQL file (species.sql) also in
> >> column 'picture_filename'.
> >
> >
> >1) Fix 2 and I think 1 will be more easily traced.
> >2) I did not see that you were keeping the species_name once the
> >user clicks on "Choose data to view." You could add a hidden input
> >field that saves the value and returns it to the script. Something like:
> >echo "";
> >Once the user clicks the button to select the data they want to
> >view, PHP has no idea what species they were viewing.
>
> That might be a good suggestion, James. I will try this shortly
> tonight. I will let you know after.
>
> Can you possibly figure out why the form is working so flaky, now? As
> above, it worked when not in a table for formating (quite well at one
> early point), basically has not worked except briefly one morning
> (without any code change I know.....) and not since. I just checked
> now and it doesn't work.
> The URL at the top shows as
> http://www.prowebcanada.com/taxa/displayspecies.php?show_woo dworking=OFF&show_numeric=OFF
> and that is even after I have chosen both user check boxes on and
> clicked on the submit button. Both should read on but both show OFF.

When I visited the site, there was an error in the generated HTML, so I
suspect your actual script in use is not identical to the one you
included in your mail.
The error was in the img tag generated for a specific wood. NULL as filename,
no quotes around url, and an extra '>' on the end.


> >Thanks,
> >James
>
> Here's hoping that you or someone can catch what I have not quite
> coded correctly.
>
> Bill
>
>
>
>
> >--
> >PHP Windows Mailing List (http://www.php.net/)
> >To unsubscribe, visit: http://www.php.net/unsub.php
> >

--
Niel Archer



--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: Getting rid of bugs I never thought I would have. Nasty bugs are gone!

am 29.06.2010 05:50:29 von Bill Mudry

--=====================_97647765==.ALT
Content-Type: text/plain; charset="us-ascii"; format=flowed

At 08:43 PM 28/06/2010, you wrote:
> > At 04:14 PM 28/06/2010, you wrote:
> > >On 06/24/2010 09:16 PM, Bill Mudry wrote:
>
> > >
> > >
> > >1) Fix 2 and I think 1 will be more easily traced.
> > >2) I did not see that you were keeping the species_name once the
> > >user clicks on "Choose data to view." You could add a hidden input
> > >field that saves the value and returns it to the script. Something like:
> > >echo " > value='{$species_name}' />";
> > >Once the user clicks the button to select the data they want to
> > >view, PHP has no idea what species they were viewing.

A great help, James, that idea worked! A great lesson for me to learn
in coding.
I had probably forgot how using hidden form tags can be so useful to preserve
variables that way. The scans no longer disappear, yahoo!


> >
> http://www.prowebcanada.com/taxa/displayspecies.php?show_woo dworking=OFF&show_numeric=OFF
> > and that is even after I have chosen both user check boxes on and
> > clicked on the submit button. Both should read on but both show OFF.
>
>When I visited the site, there was an error in the generated HTML, so I
>suspect your actual script in use is not identical to the one you
>included in your mail.
>The error was in the img tag generated for a specific wood. NULL as filename,
>no quotes around url, and an extra '>' on the end.

Thank you so much for your astute and careful effort in going over
the code. You were right :-) .
No kodos for me for forgetting to even examine the generated code.
However, I found the
errors you mentioned (including an open div tag) and corrected it. I
then noticed I had temporarily
commented the two needed $_get statement and un-commented them. That
did it. The two
informational show or not all in what the reader chooses to show --
just like they are supposed to!

Both of you are a huge help. It is so rewarding to see the species
data report area working so well now.
It is also, by the way, likely to be the most used function over time
out of all pages. Seeing all this come
together has been only in the form of a wish and dream for years
until the past year or so.

Go try it out :-). (www.prowebcanada.com/taxa)

Much thanks,

Bill Mudry









> > >Thanks,
> > >James
> >
> > Here's hoping that you or someone can catch what I have not quite
> > coded correctly.
> >
> > Bill
> >
> >
> >
> >
> > >--
> > >PHP Windows Mailing List (http://www.php.net/)
> > >To unsubscribe, visit: http://www.php.net/unsub.php
> > >
>
>--
>Niel Archer
>
>
>
>--
>PHP Windows Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php

--=====================_97647765==.ALT--