Re: [Bulk] Fwd: Re: [PHP-WIN] Error: Not a proper resource --- with code this time!

Re: [Bulk] Fwd: Re: [PHP-WIN] Error: Not a proper resource --- with code this time!

am 17.01.2011 03:24:01 von Bill Mudry

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



At 08:06 PM 1/16/2011, Bill Mudry wrote:

>>X-Apparently-To: billmudry@rogers.com via 206.190.37.191; Sun, 16
>>Jan 2011 12:58:19 -0800
>>X-YMailISG: 6IyfGVwcZAolrREihPxcaZJx7VkI8KmrvpK2cIzILvqDHzS9
>> bpXFKEo3ttD4ShKY2q6wz7M0VD_W49UPhTUK9PtkwCIAoL8yYDmvz3WvA_QY
>> uOtcL.0r0GVnnPY._MM44NpRinL61N39mZSyA0vyshF8Ml3jRYONWZ2x1_Qv
>> e_y5M9wTeC8HMX0_JN0OU1MWHlOVEe7HfGH3jX283jLJjIaJpnF4K8w_6pEv
>> 5VPFpnUApcMoJlVkd92cdxkleEaNM.iFDRcc_Xn._Lc0i5god7QPHyu6uaZv
>> PPrUFvh9i5FrxBJa8lrcyulkQU8XQwGsVfwwhdhJkzoqooItclhZGWQQSGqL
>> 9jyKDoN17p00geBpvPunM_NQlChoVEUg0CRIKRPaLPQr8fN3jQriXY33fkub
>> KXJmPnWX6kaQS.22Bmopjz6XbsUZkfKUjXv4iqe3a0q8UnVlGo.ugacfUMKL
>> TtzBHultKdb5aqhYMjE4JLncD708D41jhKkuixqgxqDyXaUFyJzQlNR4UUvt
>> 0ITdpjB2Ll1iKtsj1JT6lEv8ExFp._pCu8ayDSOlh8UsUElM6nK9xE.QDalN
>> CS6IRWAsQW2JyARyw1UuvhXMFU_FAdd6.NWLUnIxsmF7POVqsw--
>>X-Originating-IP: [76.75.200.58]
>>Authentication-Results:
>>mta1001.rog.mail.sp1.yahoo.com from=yahoo.de; domainkeys=neutral
>>(no sig); from=yahoo.de; dkim=permerror (bad sig)
>>X-Host-Fingerprint: 76.75.200.58 pb1.pair.com
>>Mailing-List: contact php-windows-help@lists.php.net; run by ezmlm
>>list-help: < mailto:php-windows-help@lists.php.net>
>>list-unsubscribe: < mailto:php-windows-unsubscribe@lists.php.net>
>>list-post: < mailto:php-windows@lists.php.net>
>>List-Id: php-windows.lists.php.net
>>Delivered-To: mailing list php-windows@lists.php.net
>>Authentication-Results: pb1.pair.com smtp.mail=cobinja@yahoo.de;
>>spf=permerror; sender-id=unknown
>>Authentication-Results: pb1.pair.com header.from=cobinja@yahoo.de;
>>sender-id=unknown
>>X-PHP-List-Original-Sender: cobinja@yahoo.de
>>X-Host-Fingerprint: 98.139.212.172 nm13.bullet.mail.bf1.yahoo.com
>>DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.de;
>>s=s1024; t=1295211472;
>>bh=IdykF5YjKiZoaZrGPumJHpZInxsOj9nKmMzsStMHx24=;
>>h=X-Yahoo-Newman-Id:Received:X-Yahoo-SMTP:X-YMail-OSG:X-Ya hoo-Newman-Property:Message-ID:Date:From:User-Agent:MIME-Ver sion:To:Subject:References:In-Reply-To:Content-Type:Content- Transfer-Encoding;
>>b=N4QXKF5e6uhF/LfR6x8MmEGtcOvSyQf1DYSbf+qIBiyZ+JcyHvobKSh8 LjR5WPwwHuXUCgLelDgeNWV86aaoUDC6FzZkS+Co+pZi7NnP+oqyUx3TcW1Q 0J29IVw3N5xNjkDxvwDAQSRKYDi2bbGNzH5r0IyFKH5Bkvu8os4KlNA=
>>X-Yahoo-Newman-Id: 619138.57359.bm@smtp111.mail.bf1.yahoo.com
>>X-Yahoo-SMTP: wQb7PoiswBDDIaOUwhs3y1Z7sRE-
>>X-YMail-OSG: _UA5GdwVM1mpaMDCk1V7eKI9qRSVFoUCGQ3PYinwqJpthdU
>> Yp7FqAy0KTHGLAFFLh1YHuUJinBVeLwGhU_xJdgH9uN3ifKJwZxXHyt8in8j
>> VGyZ3Z2V66NmS.kpx_6r7nYe3.CNn8EI4gcIjR6gx_i2VXqZmr3URoQ.fTmM
>> 6jv.5.d7_ntKTC46H9hgCtn6VvcEVJyW6B37gDNf1kYxmsTGUR6_SbEZ_Wfs
>> -
>>Date: Sun, 16 Jan 2011 21:57:47 +0100
>>From: Lars Mueller
>>User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; de;
>>rv:1.9.2.13) Gecko/20101207 Lightning/1.0b2 Thunderbird/3.1.7
>>To: php-windows@lists.php.net
>>Subject: Re: [PHP-WIN] Error: Not a proper resource --- with code this time!
>>
>>Am 15.01.2011 17:35, schrieb Bill Mudry:

Lars, thank you for your effort and willingness to help. Unfortunately,
we have a way to go yet for success:



>>>$uvquery = "SELECT `uv_filename` FROM 'uvphotos' WHERE `species_name`=
>>>$speciesname";
>>
>>That should probably be
>>... FROM `uvphotos` WHERE `species_name` = '$speciesname'";

When I substituted this suggestion I got the following error:

You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use
near ''uvphotos' WHERE `species_name` = ''' at line 1


>>or better:
>>...WHERE `species_name` = '".mysql_real_escape($speciesname)."'";

When I tried this, I found more information on mysql_real_escape() at:
http://php.net/manual/en/function.mysql-real-escape-string.p hp
With this proof that it is a valid function, it is hard to understand the
error I got when I used your second suggestion. I was surprising:

Fatal error: Call to undefined function mysql_real_escape() in
/home/content/b/i/l/billmudry/html/taxa/show_uv_photos.php on line 69

Sooo ..... I will wish you and anyone else the best but we are not at
a working solution yet.

I was thinking of listing only the section of interest but just to be
on the safe
if not complete side, I will list below the full page code as it stands.

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

[CODE]
//////////////////////////////////////////////////////////// ////////////////////////////////////////////
// Program: show_uv_photos.php
// Description: This program displays Uv fluorescence photos of wood
found to glow under an ultraviolet
// light. This is around 10% - 15% of all wood species.
//
// It runs as a pop-up window and is activated by a button titled
"U.V. Fluorescence" generated by
// displayspecies.php. Future code may be added later to display the
buttons only if the program can
// detect UV photos stored for each species.
// PARAMETERS:
// {$_SESSION["speciesname"]} - Looks back to find what the
current species picked is.
// speciesname - The session variable name for the
cuurent species.
// $speciesname - The standard variable name taken from
the session variable.
// species_name - the name of the column that stores up
to over 15,000 different botanical naes of wood.
// uvphotos - the name of the table in the TAXA database
that holds the partial path and photo file
// name
//////////////////////////////////////////////////////////// ////////////////////////////////////////////
session_start();

//ECHO "Session variable for species name is -
{$_SESSION['species_name']}"; //Debug statement
?>

"http://www.w3.org/TR/html4/loose.dtd">


TAXA: Ultraviolet Wood Fluorescence







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



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

$dbname="taxa";
$db = mysql_select_db($dbname, $connection)
or die("Unable to connect to database");
/*
------------------------------------------------------------ --------------------
HOPEFULLY CONNECTED AT THIS POINT
------------------------------------------------------------ ----------------------

*/

//////////////////////////////////////////////////////////// ///////////////////////////////////////////
//
SECTION TO DISPLAY WOOD SCANS
//////////////////////////////////////////////////////////// /////////////////////////////////////////

Echo "

";

Echo "

Ultraviolet Fluorescence Photo of
{$_SESSION["speciesname"]}

";

$speciesname = $_SESSION["speciesname"]; //Successful
transfer of ssssion parameter to a variable.
//Echo "The species name is - $speciesname
"; //Proof
that it transferred properly

//$uvquery = "SELECT * FROM uvphotos WHERE 'species_name' =
$speciesname";

$uvquery = "SELECT `uv_filename` FROM 'uvphotos'
WHERE `species_name` = '$speciesname'";


//WHERE `species_name` = '".mysql_real_escape($speciesname)."'";
//WHERE `species_name`= $speciesname";



//$uvquery = "SELECT * FROM `uvphotos` WHERE `species_name`
= '{$_SESSION["speciesname"]}' " or die ('Error: '.mysql_error
()); //No error reported.

$resultuv = mysql_query($uvquery) or die(mysql_error());

/*
if(!$resultuv)
{
die(mysql_error())
};
*/
//Echo "\$resultuv on line 58 is - $resultuv
";

//$number=mysql_num_rows($resultuv); // This and the next
line only to debug a warning
//ECHO "Number of rows is - $number
";

if(mysql_num_rows($uvresults) >0){
$row = mysql_fetch_array($resultuv);
extract($row);
}


//$uv_filename = row('uv_filename');

//ECHO "\$uv_filename on line 62 is - $uv_filename

";

//$uvfilename = "uva/acacia_anura-mulgaUV01-800.JPG";
$uvpath = "./uv/$uvfilename";

ECHO "
";

ECHO "
";

Echo "
END OF PICTURE AREA

";

Echo "
";



?>

Webmaster: This function is still Under Construction









>


Close
this Window








[/CODE]
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx



--=====================_410738823==.ALT--

Re: Re: [Bulk] Fwd: Re: [PHP-WIN] Error: Not a proper resource--- with code this time!

am 17.01.2011 05:55:03 von Lars Mueller

Am 17.01.2011 03:24, schrieb Bill Mudry:
>
> When I tried this, I found more information on mysql_real_escape() at:
>
> http://php.net/manual/en/function.mysql-real-escape-string.p hp
>
> With this proof that it is a valid function, it is hard to understand the
> error I got when I used your second suggestion. I was surprising:
>
> Fatal error: Call to undefined function mysql_real_escape() in
>

Sorry, my mistake.

Of course, the function is called mysql_real_escape_string(), not
mysql_real_escape(). You'll have to replace that in your source code.

And please note that it's not single-quotes with the table- and
column-names, but the grave accent.

What I also noticed: You're using
> //ECHO "Session variable for species name is -
{$_SESSION['species_name']}"; //Debug statement

but also

> $speciesname = $_SESSION["speciesname"];

Which one is the correct spelling of the array index?

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