php-windows Digest 1 Jul 2004 13:25:35 -0000 Issue 2303
Topics (messages 24090 through 24094):
Re: PHP OOP
24090 by: Ragnar
24091 by: Ragnar
24093 by: Ross Honniball
Re: HTTP 400 Bad Request
24092 by: Oliver John V. Tibi
Assigning an XML object to a variable?
24094 by: Brian Wilson
Administrivia:
To subscribe to the digest, e-mail:
[EMAIL PROTECTED]
To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]
To post to the list, e-mail:
[EMAIL PROTECTED]
----------------------------------------------------------------------
--- Begin Message ---
Thanks for the answers so far guys ... the thing that puzzles me is
that the query definately works fine, because if I do this:
-----------
function show_item($item) {
$sublvl = $_GET['sub'];
$qry_item = query("select ITMLIST.*, GRPLIST.NAME AS SUBNAME from
ITMLIST, GRPLIST where ITMLIST.ITEM_ID=$item AND GRPLIST.GROUP_ID =
ITMLIST.PARENT_ID AND ITMLIST.PARENT_ID = $sublvl");
$obj_item = data($qry_item);
if ($obj_item){
print $obj_item->NAME;
return $obj_item;
} else {
print "No data";
}
}
-------------
the output is fine, and when I uncomment the print line and call the script
i do not get the "No data" message, as the object exists.
Could it be that it is just not possible to return the sort of object that
ibase_fetch_object returns from a function ?
cheers,
Ben
> Ross Honniball wrote:
>
> I'm guessing your ibase_fetch_object($qry_result) call does not
> successfully retrieve any data. It then returns false and your calling
> script does nothing if false is returned.
--
+++ Jetzt WLAN-Router f�r alle DSL-Einsteiger und Wechsler +++
GMX DSL-Powertarife zudem 3 Monate gratis* http://www.gmx.net/dsl
--- End Message ---
--- Begin Message ---
Ok .. I figured it out now guys. Sorry for the hassle.
returning the object is fine, but if you don't assign another variable
with it after the function call it doesn't presist.
So what I did was (after the function declaration in the code):
if ($_GET['item']) $newitem = show_item($_GET['item']);
and then just use $newitem->property to output.
Ben
> Thanks for the answers so far guys ... the thing that puzzles me is
> that the query definately works fine, because if I do this:
>
> -----------
> function show_item($item) {
> $sublvl = $_GET['sub'];
>
> $qry_item = query("select ITMLIST.*, GRPLIST.NAME AS SUBNAME from
> ITMLIST, GRPLIST where ITMLIST.ITEM_ID=$item AND GRPLIST.GROUP_ID =
> ITMLIST.PARENT_ID AND ITMLIST.PARENT_ID = $sublvl");
>
> $obj_item = data($qry_item);
>
> if ($obj_item){
> print $obj_item->NAME;
> return $obj_item;
> } else {
> print "No data";
> }
> }
> -------------
>
> the output is fine, and when I uncomment the print line and call the
> script
> i do not get the "No data" message, as the object exists.
>
> Could it be that it is just not possible to return the sort of object that
> ibase_fetch_object returns from a function ?
>
> cheers,
>
> Ben
>
> > Ross Honniball wrote:
> >
> > I'm guessing your ibase_fetch_object($qry_result) call does not
> > successfully retrieve any data. It then returns false and your calling
> > script does nothing if false is returned.
>
> --
> +++ Jetzt WLAN-Router f�r alle DSL-Einsteiger und Wechsler +++
> GMX DSL-Powertarife zudem 3 Monate gratis* http://www.gmx.net/dsl
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
--
+++ Jetzt WLAN-Router f�r alle DSL-Einsteiger und Wechsler +++
GMX DSL-Powertarife zudem 3 Monate gratis* http://www.gmx.net/dsl
--- End Message ---
--- Begin Message ---
Have a 'look' at the object that is getting returned.
Insert 'asdf($obj_name);' as shown below and also put this script in your code.
function asdf($object, $where=false)
// Used for debugging. Reason for odd name is easy to type but also easy to
find in code to get rid of
{
$type = gettype($object);
echo '<pre>';
echo '<br>### '.$where.' ### Type='.$type.' Value=';
if ($type == 'array') {
print_r($object);
} elseif ($type == 'object') {
$class_vars = get_class_vars(get_class($object));
echo "Class vars:\n";
foreach ($class_vars as $name => $value) echo "$name : $value\n";
echo "Class methods:\n";
$class_methods = get_class_methods($object);
foreach ($class_methods as $name => $value) echo "$name : $value\n";
echo "Object vars:\n";
$class_vars = get_object_vars($object);
foreach ($class_vars as $name => $value) {
echo "$name : $value\n";
if (gettype($value) == 'array') print_r($value);
}
} else {
echo $object;
}
echo '</pre>';
}
At 12:18 PM 1/07/2004, you wrote:
Thanks for the answers so far guys ... the thing that puzzles me is
that the query definately works fine, because if I do this:
-----------
function show_item($item) {
$sublvl = $_GET['sub'];
$qry_item = query("select ITMLIST.*, GRPLIST.NAME AS SUBNAME from
ITMLIST, GRPLIST where ITMLIST.ITEM_ID=$item AND GRPLIST.GROUP_ID =
ITMLIST.PARENT_ID AND ITMLIST.PARENT_ID = $sublvl");
$obj_item = data($qry_item);
asdf($obj_name);
if ($obj_item){
print $obj_item->NAME;
return $obj_item;
} else {
print "No data";
}
}
-------------
the output is fine, and when I uncomment the print line and call the script
i do not get the "No data" message, as the object exists.
Could it be that it is just not possible to return the sort of object that
ibase_fetch_object returns from a function ?
cheers,
Ben
> Ross Honniball wrote:
>
> I'm guessing your ibase_fetch_object($qry_result) call does not
> successfully retrieve any data. It then returns false and your calling
> script does nothing if false is returned.
--
+++ Jetzt WLAN-Router f�r alle DSL-Einsteiger und Wechsler +++
GMX DSL-Powertarife zudem 3 Monate gratis* http://www.gmx.net/dsl
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
.
. Ross Honniball. JCU Bookshop Cairns, Qld, Australia.
.
--- End Message ---
--- Begin Message ---
Hi.
In addition to Luis's comment, freshly installed WINDOWS XP Professional
machines default the installation directory to C:\WINDOWS.
Cheers.
O.J.
----- Original Message -----
From: "Luis Moreira" <[EMAIL PROTECTED]>
To: "Stephen Cassidy" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Wednesday, June 30, 2004 4:47 PM
Subject: Re: [PHP-WIN] HTTP 400 Bad Request
> Stephen Cassidy wrote:
>
> >Hi all, I am fairly new to this (attended a beginners course last week)
and
> >I have been asked to install PHP on or 4 web servers (spread over 4
sites),
> >all the servers are exactly the same running Windows XP and IIS 5.
> >
> >I downloaded the latest PHP 4.3.7 and managed to install it perfectly on
3
> >of the servers the last one that I tried all seemed to install correctly
but
> >I keep getting HTTP error 400 Bad request. Someone suggested going to the
> >C:\PHP directory and creating a php document in there called test.php
with
> ><?phpinfo();?> to test I did this and PHP is working so I am baffled now.
> >The only difference I can see with the output of the file on a working
> >server and the one that is not working is the Configuration File
(php.ini)
> >Path on the server that is not working this is set to
> >"C:\Documents and Settings\administrator.INTERNAL\WINDOWS\php.ini " and
the
> >one that works
> >"C:\WINNT\php.ini ". Where is the path set? I installed PHP one each
server
> >using the same logon account?
> >
> >I hope someone can help as this is starting to drive me mad.
> >
> >Thanks
> >
> >Stephen
> >
> >
> >
> If you have taken a beginners courese last week, there is no need for
> going mad right now.
> Give it a day or two...
>
> From the Install notes :
> Copy the file, php.ini-dist to your %WINDOWS% directory on
> Windows 95/98 or to your %SYSTEMROOT% directory under Windows NT,
> Windows 2000 or Windows XP and rename it to php.ini. Your %WINDOWS% or
> %SYSTEMROOT% directory is typically:
> c:\windows for Windows 95/98
> c:\winnt or c:\winnt40 for NT/2000/XP servers
>
> Try to move the PHP.ini file to c:\winnt on the non-working system and
> retry.
>
> Luis
>
>
----------------------------------------------------------------------------
----
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
I'm sending a request to a remote web page using PHP's cURL in order to get
a response back in XML. I've done this before and usually assign the
response to a variable (eg. $result) before using Sablatron to transorm the
XML. Here is the code I've been using:
<?php
$varsent = 'a='.$a.'&b='.$b.'&c='.$c.'&d='.$d;
$ch=curl_init();
curl_setopt($ch,CURLOPT_URL,"http://www.mysite.com/xml.asp");
curl_setopt($ch,CURLOPT_POST,1);
curl_setopt($ch,CURLOPT_POSTFIELDS, $varsent);
$result=curl_exec($ch);
curl_close($ch);
?>
My next step is usually to XSLT the response held in $result. The problem
with that is that $result is holding the value '1', which I'm assuming is
simply the boolean 'true'. To see the XML response I have to
right-click/view source on the browser page. Can anyone point me in the
right direction to find out how to put this 'embedded' XML into a string or
something else that I can transform? Thanks for reading.
Brian
--- End Message ---