php-general Digest 15 Dec 2009 00:47:24 -0000 Issue 6488

Topics (messages 300482 through 300505):

Re: Highlighting image map on load
        300482 by: Ashley Sheridan
        300491 by: tedd

Re: Strange MySQL Problem
        300483 by: Floyd Resler
        300488 by: tedd

Re: file_get_contents ($file) works -- file_get_contents ($url) returns false
        300484 by: Gaurav Kumar
        300485 by: Ren¨¦ Fournier
        300486 by: Cafer Şimşek
        300487 by: Ren¨¦ Fournier
        300489 by: Cafer Şimşek
        300490 by: Ashley Sheridan

Problem with XPath query
        300492 by: Christoph Boget
        300493 by: Jonathan Tapicer
        300494 by: Christoph Boget
        300495 by: Lester Caine
        300496 by: Jim Lucas

can't retrieve more than 1 record at the time still
        300497 by: Catherine Madsen

Problem with LDAP functions in PHP
        300498 by: Lic. Eduardo Ricardo Hernandez Osorio

Re: MySQL Appeal from Monty
        300499 by: Philip Thompson
        300502 by: Ashley Sheridan

Re: PHP live chat
        300500 by: Philip Thompson

Re: Best ajax library
        300501 by: Philip Thompson

PHP + ODBC
        300503 by: Philip Thompson

strip tags but preserve title attributes
        300504 by: Ashley Sheridan

Class not functioning
        300505 by: Allen McCabe

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 ---
On Mon, 2009-12-14 at 04:37 -0800, leledumbo wrote:

> I have image map with dynamic circle areas whose coordinates stored in
> database. I'd like to colorize these areas so that it's obvious to see them.
> Most solutions I found on the net highlights the area on mouse hover, while
> my needs is to do it once when the window is loaded. Any idea?
> -- 
> View this message in context: 
> http://old.nabble.com/Highlighting-image-map-on-load-tp26777088p26777088.html
> Sent from the PHP - General mailing list archive at Nabble.com.
> 
> 


I'm not sure if you can use CSS alone to highlight, but if you can, just
give the area a class as you output it with PHP.

Otherwise, you could try and output the SVG/VML you'd need on that area
depending on the browser.

Thanks,
Ash
http://www.ashleysheridan.co.uk



--- End Message ---
--- Begin Message ---
At 4:37 AM -0800 12/14/09, leledumbo wrote:
I have image map with dynamic circle areas whose coordinates stored in
database. I'd like to colorize these areas so that it's obvious to see them.
Most solutions I found on the net highlights the area on mouse hover, while
my needs is to do it once when the window is loaded. Any idea?

Idea?

Yes, this is a server-side function -- as such, you'll need a server-side language.

I think the problem has been solved. If it was me, I would start with jQuery. Here's an example of a mouseover hover effect.

http://sexy.hohli.com/

Apologies for the content, but the effect I think is similar to what you wanted.

Cheers,

tedd

--
-------
http://sperling.com  http://ancientstones.com  http://earthstones.com

--- End Message ---
--- Begin Message ---
You're missing a tick in the query.  There should be a tick before the 
$_POST[ISBN].

Take care,
Floyd

On Dec 14, 2009, at 3:41 AM, Parham Doustdar wrote:

> Hello there,
> Here's a short PHP script a friend has written, and given to me to test.
> However, I am getting a MySQL error saying that the syntax error, on the
> line that contains mysql_connect(); is wrong, near '')'
> (note that it is not a PHP error, but a MySQL error.)
> Here's the code:
> 
> [code]
> <?php
> $username = "root";
> $password = "abc";
> $con = mysql_connect("", $username, $password);
> mysql_select_db ("test", $con);
> $sql = "INSERT INTO BOOK(bookname, authorsname, ISBN) VALUES
> ('$_POST[bookname]', '$_POST[authorsname]', $_POST[ISBN]')";
> if (!mysql_query($sql, $con))
> {
> die( 'error: ' . mysql_error());
>  }
> echo "1 record added";
> mysql_close($con)
> ?>
> [/code]
> 
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php


--- End Message ---
--- Begin Message ---
At 1:12 PM +0330 12/14/09, Parham Doustdar wrote:
Thank you, everyone. All fixed.


Really?!?

I think you would be well advised to sanitize the values coming into from a public $_POST.

That habit allows MySQL injection problems.

Cheers,

tedd
--
-------
http://sperling.com  http://ancientstones.com  http://earthstones.com

--- End Message ---
--- Begin Message ---
Sorry buddy, I cant think of anything else which is going on wrong.


2009/12/14 René Fournier <[email protected]>

>
> PHP Version 5.3.0
>
> Directive Local Value Master Value
> allow_call_time_pass_reference Off Off
> allow_url_fopen On
>
>
> On 2009-12-14, at 12:26 AM, Gaurav Kumar wrote:
>
> What is the value for 
> "allow_url_fopen<http://www.php.net/manual/en/filesystem.configuration.php#ini.allow-url-fopen>"
> in your php.ini? It should be 1.
>
>
>
>
>
> 2009/12/13 René Fournier <[email protected]>
>
>> CURL works (remote and local)
>> file_get_contents() doesn't work (remote or local).
>>
>>
>>
>> On 2009-12-13, at 4:39 PM, Gaurav Kumar wrote:
>>
>> Ok Agreed.
>>
>> Lets do one last chance to ensure that your system is allowing external
>> connections or connection to other systems in the network-
>>
>> Use Curl to get in the file contents. Check your PHP that Curl is enabled.
>> Through phpinfo();
>>
>> If the script output the google page then this means that there is nothing
>> that is stopping you form getting in the content externally.
>>
>> <?php
>> //     $str =  file_get_contents ('http://www.google.com');
>> //     echo $str;
>>
>>
>> // create a new cURL resource
>> $ch = curl_init();
>>
>> // set URL and other appropriate options
>> curl_setopt($ch, CURLOPT_URL, "http://www.google.co.in";); //
>> http://www.google.com
>> curl_setopt($ch, CURLOPT_HEADER, 0);
>>
>> // grab URL and pass it to the browser
>> curl_exec($ch);
>>
>> // close cURL resource, and free up system resources
>> curl_close($ch);
>>
>> ?>
>>
>> Thanks,
>>
>> Gaurav Kumar
>>
>>
>>
>> 2009/12/13 René Fournier <[email protected]>
>>
>>> The thing is, the file_get_contents() fails the same way on local URLs --
>>> that is, web sites hosted on the same machine. Or even using the machine's
>>> own IP address.
>>>
>>> On 2009-12-13, at 4:00 AM, Gaurav Kumar wrote:
>>>
>>> Hi Rene,
>>>
>>> The only thing which is a hurdle is that your system/computer is not
>>> allowing external connections. There seems to be nothing else wrong.
>>>
>>> I strongly suggest check your system firewall, any central server
>>> settings through which your system gets internet access, any antivirus s/w
>>> installed etc.. this can be the only reason. Something is stopping you to
>>> access external connection.
>>>
>>> Let me know when your problem is fixed.
>>> Also I tried the below code and it works fine-
>>>
>>> <?php
>>>     $str =  file_get_contents ('http://www.google.com');
>>>     echo $str;
>>> ?>
>>>
>>> Thanks,
>>>
>>> Gaurav Kumar
>>>
>>>
>>>
>>> 2009/12/11 René Fournier <[email protected]>
>>>
>>>> Hi Gaurav,
>>>>
>>>> On 2009-12-11, at 2:55 PM, Gaurav Kumar wrote:
>>>>
>>>> A very typical problem. Good you sent the error message.
>>>>
>>>> This problem can be caused due to one of the following-
>>>>
>>>> 1. I have faced similar problem due to local firewall settings.
>>>>
>>>>
>>>> Don't think this is it, since (1) the firewall settings haven't changed,
>>>> and (2) other machines on the same network can execute this same code and
>>>> function (but they aren't running OS X Server 10.6.
>>>>
>>>> 2. Try some other domain; i.e. other than google com. Try some of the
>>>> local area website with a particular page like
>>>> www.somedomain.com/somefile.html
>>>>
>>>>
>>>> I've tried many different external and local web sites, and they all
>>>> fail.
>>>>
>>>> 3. Some times the remote host does not allow you to connect to get the
>>>> file contents.
>>>>
>>>>
>>>> (Also not the cause -- as explained above.)
>>>>
>>>>
>>>> 4. # 3 can be either way round from both the ends a) you host server
>>>> does not allow external connections b) Remote host does not allow anonymous
>>>> connection.
>>>>
>>>>
>>>> Thanks for the options. I don't think they apply in this case. If you
>>>> have any other suggestions on what to do, I would welcome them.
>>>>
>>>>
>>>>
>>>> Gaurav Kumar
>>>> blog.oswebstudio.com
>>>>
>>>>
>>>>
>>>> On Thu, Dec 10, 2009 at 9:01 PM, René Fournier 
>>>> <[email protected]>wrote:
>>>>
>>>>> I thought error_reporting would display them, but I guess php.ini had
>>>>> them suppressed. Anyway, with:
>>>>>
>>>>> <?php
>>>>>
>>>>> error_reporting(-1);
>>>>> ini_set('display_errors', 1);
>>>>> set_time_limit(0);
>>>>> var_dump (file_get_contents ('http://www.google.com'));
>>>>>
>>>>> ?>
>>>>>
>>>>> I get:
>>>>>
>>>>> Warning: file_get_contents(http://www.google.com): failed to open
>>>>> stream: Operation now in progress in /____/____.php on line 7 bool(false)
>>>>>
>>>>> Does that help with the diagnosis?
>>>>>
>>>>>
>>>>> On 2009-12-10, at 12:28 AM, Richard Quadling wrote:
>>>>>
>>>>> > 2009/12/9 René Fournier <[email protected]>:
>>>>> >> It is, and I use curl elsewhere in the same script to fetch remote
>>>>> content.
>>>>> >> This exact same function works fine on my MacBook Pro (10.6 client,
>>>>> PHP 5.3), and *was* previously working fine under Server 10.4.11 and PHP
>>>>> 5.3,
>>>>> >>
>>>>> >> On 2009-12-09, at 11:10 PM, laruence wrote:
>>>>> >>
>>>>> >>> try
>>>>> >>> wget http://www.google.com in your command line to see whether the
>>>>> network is reachable
>>>>> >>>
>>>>> >>> LinuxManMikeC wrote:
>>>>> >>>>
>>>>> >>>> On Wed, Dec 9, 2009 at 8:02 AM, LinuxManMikeC <
>>>>> [email protected]> wrote:
>>>>> >>>>
>>>>> >>>>> On Wed, Dec 9, 2009 at 6:45 AM, René Fournier <
>>>>> [email protected]> wrote:
>>>>> >>>>>
>>>>> >>>>>> Strange problem I'm having on Mac OS X Server 10.6 running PHP
>>>>> 5.3. Any call of file_get_contents() on a local file works fine -- the 
>>>>> file
>>>>> is read and returned. But any call of file_get_contents on a url -- any 
>>>>> url,
>>>>> local or remote -- always returns false.
>>>>> >>>>>>
>>>>> >>>>>> var_dump (file_get_contents 
>>>>> >>>>>> ('http://www.google.com/')<http://www.google.com/%27%29>
>>>>> );
>>>>> >>>>>>
>>>>> >>>>>> bool(false)
>>>>> >>>>>>
>>>>> >>>>>> I've checked php.ini, and the obvious seems okay:
>>>>> >>>>>>
>>>>> >>>>>>        allow_url_fopen => On => On
>>>>> >>>>>>
>>>>> >>>>>> Any ideas?
>>>>> >>>>>>
>>>>> >>>>>> ...Rene
>>>>> >>>>>>
>>>>> >>>>>
>>>>> http://us2.php.net/manual/en/filesystem.configuration.php#ini.allow-url-fopen
>>>>> >>>>>
>>>>> >>>>>
>>>>> >>>>
>>>>> >>>> "I've checked php.ini"
>>>>> >>>> Right, must remember not to reply to stuff till I'm awake. :-D
>>>>> >>>>
>>>>> >>>> --
>>>>> >>>> PHP General Mailing List (http://www.php.net/)
>>>>> >>>> To unsubscribe, visit: http://www.php.net/unsub.php
>>>>> >>>>
>>>>> >>>>
>>>>> >>>
>>>>> >>> --
>>>>> >>> <2866791487_dbbbdddf9e.jpg>惠 新宸 xinchen.hui | 商务搜索部 |
>>>>> (+8610)82602112-7974 | <2866349865_203e53a6c6.jpg>:laruence
>>>>> >>
>>>>> >>
>>>>> >
>>>>> > Do you have ANY errors/warning/notices?
>>>>> >
>>>>> >
>>>>> >
>>>>> > --
>>>>> > -----
>>>>> > Richard Quadling
>>>>> > "Standing on the shoulders of some very clever giants!"
>>>>> > EE : http://www.experts-exchange.com/M_248814.html
>>>>> > Zend Certified Engineer :
>>>>> http://zend.com/zce.php?c=ZEND002498&r=213474731
>>>>> > ZOPA : http://uk.zopa.com/member/RQuadling
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>

--- End Message ---
--- Begin Message ---
Well thanks for trying. For anyone reading this, who wants to be a hero and 
solve the impossible:

1.      file_get_contents ($url) doesn't work -- (on remote URLs or local URLs)
2.      file_get_contents ($file) works.
3.      CURL works (on remote and local URLs).
4.      as per php.ini, allow_url_fopen On

Xserve
- OS X Server 10.6.2
- PHP 5.3 (default)


So... it's as if PHP is not respecting the allow_url_fopen direction in 
php.ini. If that directive were set to Off, everything would make sense (files 
load, urls don't (local or remote)).

Anyone have anything to add? Anyone, anyone?

Bueller?


On 2009-12-14, at 10:05 PM, Gaurav Kumar wrote:

> Sorry buddy, I cant think of anything else which is going on wrong.
> 
> 
> 2009/12/14 René Fournier <[email protected]>
> 
> PHP Version   5.3.0
> 
> Directive     Local Value     Master Value
> allow_call_time_pass_reference        Off     Off
> allow_url_fopen       On
> 
> 
> On 2009-12-14, at 12:26 AM, Gaurav Kumar wrote:
> 
>> What is the value for "allow_url_fopen" in your php.ini? It should be 1.
>> 
>> 
>> 
>> 
>> 
>> 2009/12/13 René Fournier <[email protected]>
>> CURL works (remote and local)
>> file_get_contents() doesn't work (remote or local).
>> 
>> 
>> 
>> On 2009-12-13, at 4:39 PM, Gaurav Kumar wrote:
>> 
>>> Ok Agreed. 
>>> 
>>> Lets do one last chance to ensure that your system is allowing external 
>>> connections or connection to other systems in the network-
>>> 
>>> Use Curl to get in the file contents. Check your PHP that Curl is enabled. 
>>> Through phpinfo();
>>> 
>>> If the script output the google page then this means that there is nothing 
>>> that is stopping you form getting in the content externally.
>>> 
>>> <?php
>>> //     $str =  file_get_contents ('http://www.google.com');
>>> //     echo $str;
>>> 
>>> 
>>> // create a new cURL resource
>>> $ch = curl_init();
>>> 
>>> // set URL and other appropriate options
>>> curl_setopt($ch, CURLOPT_URL, "http://www.google.co.in";); 
>>> //http://www.google.com
>>> curl_setopt($ch, CURLOPT_HEADER, 0);
>>> 
>>> // grab URL and pass it to the browser
>>> curl_exec($ch);
>>> 
>>> // close cURL resource, and free up system resources
>>> curl_close($ch);
>>> 
>>> ?>
>>> 
>>> Thanks,
>>> 
>>> Gaurav Kumar
>>> 
>>> 
>>> 
>>> 2009/12/13 René Fournier <[email protected]>
>>> The thing is, the file_get_contents() fails the same way on local URLs -- 
>>> that is, web sites hosted on the same machine. Or even using the machine's 
>>> own IP address.
>>> 
>>> On 2009-12-13, at 4:00 AM, Gaurav Kumar wrote:
>>> 
>>>> Hi Rene,
>>>> 
>>>> The only thing which is a hurdle is that your system/computer is not 
>>>> allowing external connections. There seems to be nothing else wrong.
>>>> 
>>>> I strongly suggest check your system firewall, any central server settings 
>>>> through which your system gets internet access, any antivirus s/w 
>>>> installed etc.. this can be the only reason. Something is stopping you to 
>>>> access external connection.
>>>> 
>>>> Let me know when your problem is fixed.
>>>> Also I tried the below code and it works fine-
>>>> 
>>>> <?php
>>>>     $str =  file_get_contents ('http://www.google.com');
>>>>     echo $str;
>>>> ?>
>>>> 
>>>> Thanks,
>>>> 
>>>> Gaurav Kumar
>>>> 
>>>> 
>>>> 
>>>> 2009/12/11 René Fournier <[email protected]>
>>>> Hi Gaurav,
>>>> 
>>>> On 2009-12-11, at 2:55 PM, Gaurav Kumar wrote:
>>>> 
>>>>> A very typical problem. Good you sent the error message.
>>>>> 
>>>>> This problem can be caused due to one of the following-
>>>>> 
>>>>> 1. I have faced similar problem due to local firewall settings.
>>>> 
>>>> Don't think this is it, since (1) the firewall settings haven't changed, 
>>>> and (2) other machines on the same network can execute this same code and 
>>>> function (but they aren't running OS X Server 10.6.
>>>> 
>>>>> 2. Try some other domain; i.e. other than google com. Try some of the 
>>>>> local area website with a particular page like 
>>>>> www.somedomain.com/somefile.html
>>>> 
>>>> I've tried many different external and local web sites, and they all fail.
>>>> 
>>>>> 3. Some times the remote host does not allow you to connect to get the 
>>>>> file contents.
>>>> 
>>>> (Also not the cause -- as explained above.)
>>>> 
>>>> 
>>>>> 4. # 3 can be either way round from both the ends a) you host server does 
>>>>> not allow external connections b) Remote host does not allow anonymous 
>>>>> connection.
>>>> 
>>>> Thanks for the options. I don't think they apply in this case. If you have 
>>>> any other suggestions on what to do, I would welcome them.
>>>> 
>>>> 
>>>> 
>>>>> Gaurav Kumar
>>>>> blog.oswebstudio.com
>>>>> 
>>>>> 
>>>>> 
>>>>> On Thu, Dec 10, 2009 at 9:01 PM, René Fournier <[email protected]> 
>>>>> wrote:
>>>>> I thought error_reporting would display them, but I guess php.ini had 
>>>>> them suppressed. Anyway, with:
>>>>> 
>>>>> <?php
>>>>> 
>>>>> error_reporting(-1);
>>>>> ini_set('display_errors', 1);
>>>>> set_time_limit(0);
>>>>> var_dump (file_get_contents ('http://www.google.com'));
>>>>> 
>>>>> ?>
>>>>> 
>>>>> I get:
>>>>> 
>>>>> Warning: file_get_contents(http://www.google.com): failed to open stream: 
>>>>> Operation now in progress in /____/____.php on line 7 bool(false)
>>>>> 
>>>>> Does that help with the diagnosis?
>>>>> 
>>>>> 
>>>>> On 2009-12-10, at 12:28 AM, Richard Quadling wrote:
>>>>> 
>>>>> > 2009/12/9 René Fournier <[email protected]>:
>>>>> >> It is, and I use curl elsewhere in the same script to fetch remote 
>>>>> >> content.
>>>>> >> This exact same function works fine on my MacBook Pro (10.6 client, 
>>>>> >> PHP 5.3), and *was* previously working fine under Server 10.4.11 and 
>>>>> >> PHP 5.3,
>>>>> >>
>>>>> >> On 2009-12-09, at 11:10 PM, laruence wrote:
>>>>> >>
>>>>> >>> try
>>>>> >>> wget http://www.google.com in your command line to see whether the 
>>>>> >>> network is reachable
>>>>> >>>
>>>>> >>> LinuxManMikeC wrote:
>>>>> >>>>
>>>>> >>>> On Wed, Dec 9, 2009 at 8:02 AM, LinuxManMikeC 
>>>>> >>>> <[email protected]> wrote:
>>>>> >>>>
>>>>> >>>>> On Wed, Dec 9, 2009 at 6:45 AM, René Fournier 
>>>>> >>>>> <[email protected]> wrote:
>>>>> >>>>>
>>>>> >>>>>> Strange problem I'm having on Mac OS X Server 10.6 running PHP 
>>>>> >>>>>> 5.3. Any call of file_get_contents() on a local file works fine -- 
>>>>> >>>>>> the file is read and returned. But any call of file_get_contents 
>>>>> >>>>>> on a url -- any url, local or remote -- always returns false.
>>>>> >>>>>>
>>>>> >>>>>> var_dump (file_get_contents ('http://www.google.com/'));
>>>>> >>>>>>
>>>>> >>>>>> bool(false)
>>>>> >>>>>>
>>>>> >>>>>> I've checked php.ini, and the obvious seems okay:
>>>>> >>>>>>
>>>>> >>>>>>        allow_url_fopen => On => On
>>>>> >>>>>>
>>>>> >>>>>> Any ideas?
>>>>> >>>>>>
>>>>> >>>>>> ...Rene
>>>>> >>>>>>
>>>>> >>>>> http://us2.php.net/manual/en/filesystem.configuration.php#ini.allow-url-fopen
>>>>> >>>>>
>>>>> >>>>>
>>>>> >>>>
>>>>> >>>> "I've checked php.ini"
>>>>> >>>> Right, must remember not to reply to stuff till I'm awake. :-D
>>>>> >>>>
>>>>> >>>> --
>>>>> >>>> PHP General Mailing List (http://www.php.net/)
>>>>> >>>> To unsubscribe, visit: http://www.php.net/unsub.php
>>>>> >>>>
>>>>> >>>>
>>>>> >>>
>>>>> >>> --
>>>>> >>> <2866791487_dbbbdddf9e.jpg>惠 新宸 xinchen.hui | 商务搜索部 | 
>>>>> >>> (+8610)82602112-7974 | <2866349865_203e53a6c6.jpg>:laruence
>>>>> >>
>>>>> >>
>>>>> >
>>>>> > Do you have ANY errors/warning/notices?
>>>>> >
>>>>> >
>>>>> >
>>>>> > --
>>>>> > -----
>>>>> > Richard Quadling
>>>>> > "Standing on the shoulders of some very clever giants!"
>>>>> > EE : http://www.experts-exchange.com/M_248814.html
>>>>> > Zend Certified Engineer : 
>>>>> > http://zend.com/zce.php?c=ZEND002498&r=213474731
>>>>> > ZOPA : http://uk.zopa.com/member/RQuadling
>>>>> 
>>>>> 
>>>> 
>>>> 
>>> 
>>> 
>> 
>> 
> 
> 


--- End Message ---
--- Begin Message ---
René Fournier <[email protected]> writes:

> 4.    as per php.ini, allow_url_fopen On

Look at from phpinfo() the settings is already "On".

Best Regards.

-- 
Cafer Şimşek
DEV Staff Leader
http://pazar.com/

--- End Message ---
--- Begin Message ---
On 2009-12-14, at 10:44 PM, Cafer Şimşek wrote:

> René Fournier <[email protected]> writes:
> 
>> 4.   as per php.ini, allow_url_fopen On
> 
> Look at from phpinfo() the settings is already "On".

Yes, I know.

Which is why it's odd that the function fails on URLs.


--- End Message ---
--- Begin Message ---
René Fournier <[email protected]> writes:

> On 2009-12-14, at 10:44 PM, Cafer Şimşek wrote:
>
>> René Fournier <[email protected]> writes:
>> 
>>> 4.  as per php.ini, allow_url_fopen On
>> 
>> Look at from phpinfo() the settings is already "On".
>
> Yes, I know.
>
> Which is why it's odd that the function fails on URLs.

try to get url content from any browser or (if you use Linux / Unix)
curl.

-- 
Cafer Şimşek
DEV Staff Leader
http://pazar.com/

--- End Message ---
--- Begin Message ---
On Mon, 2009-12-14 at 17:03 +0200, Cafer Şimşek wrote:

> René Fournier <[email protected]> writes:
> 
> > On 2009-12-14, at 10:44 PM, Cafer Şimşek wrote:
> >
> >> René Fournier <[email protected]> writes:
> >> 
> >>> 4.        as per php.ini, allow_url_fopen On
> >> 
> >> Look at from phpinfo() the settings is already "On".
> >
> > Yes, I know.
> >
> > Which is why it's odd that the function fails on URLs.
> 
> try to get url content from any browser or (if you use Linux / Unix)
> curl.
> 
> -- 
> Cafer Şimşek
> DEV Staff Leader
> http://pazar.com/
> 


He already said Curl works, and changing the browser won't affect what
PHP is doing.

Thanks,
Ash
http://www.ashleysheridan.co.uk



--- End Message ---
--- Begin Message ---
Given the following XML:

<Pages>
  <Page>
    <DisplayRef alias="Widget">
      <parameter alias="widgetType" type="variable" value="system"/>
    </DisplayRef>
  </Page>
</Pages>

I'm using the following query:

$oXPath->query( '//DisplayRef/paramet...@alias="widgetType and
@value="system"]' );

and I'm getting the following error:

Warning: DOMXPath::query() [function.DOMXPath-query]: Invalid predicate

If I remove this part of the query

[...@alias="widgetType and @value="system"]

the error goes away.

As far as I can tell from googling around, the query is valid.  If
that's the case, I don't understand what's causing the error.
Could someone explain to me what I'm doing wrong?

thnx,
Christoph

--- End Message ---
--- Begin Message ---
Hi,

You are missing a quote after widgetType:

[...@alias="widgetType and @value="system"]

should be

[...@alias="widgetType" and @value="system"]

Regards,

Jonathan

On Mon, Dec 14, 2009 at 1:52 PM, Christoph Boget
<[email protected]> wrote:
> Given the following XML:
>
> <Pages>
>  <Page>
>    <DisplayRef alias="Widget">
>      <parameter alias="widgetType" type="variable" value="system"/>
>    </DisplayRef>
>  </Page>
> </Pages>
>
> I'm using the following query:
>
> $oXPath->query( '//DisplayRef/paramet...@alias="widgetType and
> @value="system"]' );
>
> and I'm getting the following error:
>
> Warning: DOMXPath::query() [function.DOMXPath-query]: Invalid predicate
>
> If I remove this part of the query
>
> [...@alias="widgetType and @value="system"]
>
> the error goes away.
>
> As far as I can tell from googling around, the query is valid.  If
> that's the case, I don't understand what's causing the error.
> Could someone explain to me what I'm doing wrong?
>
> thnx,
> Christoph
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--- End Message ---
--- Begin Message ---
> You are missing a quote after widgetType:

Yeah, I realized that about 2 minutes after I sent the message.  Man,
I'm dumb. :p  I was banging my head against the wall for a while
because of that.  I guess when you bring your stupidity public, you'll
find the solution yourself that much quicker. ;)

thnx,
Christoph

--- End Message ---
--- Begin Message ---
Christoph Boget wrote:
You are missing a quote after widgetType:

Yeah, I realized that about 2 minutes after I sent the message.  Man,
I'm dumb. :p  I was banging my head against the wall for a while
because of that.  I guess when you bring your stupidity public, you'll
find the solution yourself that much quicker. ;)

I often find that it's quicker to ask - because invariably the answer presents itself the second you hit send ;)

--
Lester Caine - G8HFL
-----------------------------
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk//
Firebird - http://www.firebirdsql.org/index.php

--- End Message ---
--- Begin Message ---
Lester Caine wrote:
> 
> I often find that it's quicker to ask - because invariably the answer
> presents itself the second you hit send ;)
> 

Isn't that the truth!

Jim

--- End Message ---
--- Begin Message ---
Hi Again,

Following the suggestions I received from a earlier post, I've closed the statement
while ($stmt->fetch(PDO::FETCH_BOUND))
before $stmt = NULL;
I don't get an error anymore, but still retrieve only one record.

To check that the array was being filled correctly, I inserted in several places $ncand = count($_SESSION['numberCand']);
$ndocid = count($_SESSION['DOCIDs']);
and the count is always 0 for $ndocid and 1 for $ncand.
Now I believe that the array is not being filled, and that's why only the last record gets processed. Can anybody see what I'm doing wrong in the for each statement? The updated code is below. Thank you for your help.
Catherine


Earlier message:
I'm really in need of help. I'm not a PHP programmer, but I've been given the privilege of customizing a script written by somebody else and can't get it to work right. I have to query 2 different tables in 2 different Oracle 10G DBs, one's mine (my_schema.my_table), the other (otherdb.other_table) belongs to another department. In my_table, I have the doc_id and the app_id for a record. In other_table there's the doc_id and pdf to retrieve. The goal is to make a PDF file from each BLOB in other_table and store them in the right directory under hash(app_id). PDO has been installed and working, and I can connect to both DBs without a problem. If my query limits the retrieval to one record, the script works, but if I try to run it for all records, one pdf file is correctly created in the right directory then I get the following error: PHP Fatal error: Call to a member function fetch() on a non-object in /my_location/my_script.php on line 154. It the "while ($stmt->fetch(PDO::FETCH_BOUND))" line. I've pasted my script below. I thought my problem was that maybe I was in the wrong directory after creation of the first pdf, but several tries changing the directory didn't make a difference. Right now, I'm running the script at the command line. Soon I'm going to have a few hundred records to deal with and cannot do it one by one! Any help would be very much appreciated. Thank you!

<?php


/* First Oracle DB connection info removed */

try
{
   $dbh1 = new PDO("oci:dbname=".$tns1,$db1_username,$db1_password);

}

catch(PDOException $e)
{
   echo ($e->getMessage());
   exit;
}


if (empty($_SESSION['docIDs']))
{
        $_SESSION['DOCIDs'] = array();
        $_SESSION['msgs'] = array();

        $sql = "SELECT COUNT(*) all_rec FROM myschema.mytable
                where academic_year = 2010";

        $_SESSION['numberCand'] = 0;  /* initialize ctr for stack popping */
        $_SESSION['PHPulled'] = 0; /* number new personal histories pulled */

        if ($res = $dbh1->query($sql))
        
        {
        
        /* Check the number of rows that match the SELECT statement */
          if ($res->fetchColumn() > 0)
                {
                        /* Issue the real SELECT statement and work with the 
results */
                         $sql = "select doc_id, app_id
                        from myschema.mytable
                        where academic_year = 2010";

                   foreach ($dbh1->query($sql) as $row)
                   {

                        $cand = array();
                        $cand['DOC_ID']= $row['DOC_ID'];
                        $cand['APP_ID'] = $row['APP_ID'];
                        $_SESSION['DOC_IDS'][] = $cand;

                   }
              }
$ncand = count($_SESSION['numberCand']);
$ndocid = count($_SESSION['DOCIDs']);
print "Cand Number: " .  $ncand . "\n";
print "DOCid Number: " .  $ndocid . "\n";
        }
}

if (!empty($_SESSION['DOC_IDS']) and $_SESSION['numberCand'] < 
count($_SESSION['DOC_IDS']))
{       
$ncand = count($_SESSION['numberCand']);
$ndocid = count($_SESSION['DOCIDs']);
print "Cand Number: " .  $ncand . "\n";
print "DOCid Number: " .  $ndocid . "\n";

   /* if have doc_IDs, pick next one off array  */
   $cand = $_SESSION['DOC_IDS'][$_SESSION['numberCand']];

   if ($cand['DOC_ID'] == 0)
   {  /*  redirect to self to get next candidate with updated numberCand */
       $_SESSION['numberCand'] = $_SESSION['numberCand'] + 1;
       exit;
   }

        $dirname = md5($cand['APP_ID']);
        $curdir = '/my_location/'.$dirname;

        print "App_id/Dir: " .  $row['APP_ID'] . $curdir . "\n";

         if (!(is_dir($curdir)))

                          {
                                  if (!mkdir($curdir,0775))
                                  print "error: " . $curdir . "\n";
                                  exit;
                          }

/* Second Oracle DB connection  info removed */

        try
        {
                $dbh2 = new 
PDO("oci:dbname=".$tns2,$db2_username,$db2_password);

        }

        catch(PDOException $e)
        {
                echo ($e->getMessage());
                exit;
        }


        $stmt = $dbh2->prepare('select PERSONAL_HIST_PDF_CONTENT from 
otherdb.other_table
        where DOC_ID = :id');

        $stmt->bindParam(':id', $cand['DOC_ID'], PDO::PARAM_INT);
        $stmt->bindColumn(1, $PDF, PDO::PARAM_LOB);

        $stmt->execute();

        if (!(chdir($curdir)))
                {
                        $_SESSION['msgs'][] = 'Could not change to '.$curdir;
                        continue;
                }

        $cnt = 0;

                while ($stmt->fetch(PDO::FETCH_BOUND))
                {
                        $filename = 'phs-'.$cnt.'.pdf';

                   if (!file_exists($filename))
                        { /* if file not already there, write file with BLOB 
contents */
                                $fh = fopen($filename, 'w');
                                fwrite($fh, stream_get_contents($PDF));
                                fclose($fh);

                                /* add to $_SESSION['PHPulled'] for each new 
file saved */
                                $_SESSION['PHPulled'] = $_SESSION['PHPulled'] + 
1;
                         }
                }

                /* increment stack counter */
                $_SESSION['numberCand'] = $_SESSION['numberCand'] + 1;

                $stmt = NULL; /* release the connection */

                  /*if not done with stack, redirect to self to get next*/
                if (!empty($_SESSION['DOCIDs']) and
                        $_SESSION['numberCand'] < count($_SESSION['DOCIDs']))
                        {
                                exit;

                        }
                
}

/* once done, go back to display search page after clearing stack*/
if(isset($_SESSION['DOCIDs']))
unset($_SESSION['DOCIDs'] );

$_SESSION['msgs'][] = 'For '.$_SESSION['numberCand'].' candidate(s), '.
$_SESSION['PHPulled'].' personal histories were loaded.';
exit;

$res = null;
$dbh1 = null;

?>

--
Catherine Madsen

Programmer Analyst
College of Chemistry
Berkeley, CA 94720-1460

TEL: 510-643-1706
FAX: 510-643-6178


--- End Message ---
--- Begin Message ---
Hello:
I am trying to accomplish searches in a Windows active directory through
LDAP functions in PHP, but the function ldap_search and ldap_get_entries are
out of service, they give the following error messages 

Warning: ldap_search() [function.ldap-search]: Search: Operations error in
C:\xampp\htdocs\asesor\ldaptest.php on line 20

Warning: ldap_get_entries(): supplied argument is not a valid ldap result
resource in C:\xampp\htdocs\asesor\ldaptest.php on line 22

Here I send you the PHP code:
    $r=ldap_bind($ds, 'iespaloma\\poweruser', 'dfku34*+);     //
Autentificacion anonima, habitual de los accesos de solo lectura
    echo "El resultado de la autentificacion es ".$r."<br />";
    $persona = 'Ad';    
    $dn = "dc=iespaloma,dc=com";
    $filtro="(givenname=$persona*)";
    $solonecesito = array( "ou", "sn", "givenname", "mail");
    $sr=ldap_search($ds, $dn, $filtro, $solonecesito);
    $info = ldap_get_entries($ds, $sr); 
I believe that the error occur due a bad DN that I am passing to the
function, Could anyone help me to solve this problem?


 
Aeropuerto Internacional Frank País García de Holguín.





--- End Message ---
--- Begin Message ---
On Dec 14, 2009, at 12:51 AM, Lester Caine wrote:

> Lenin wrote:
>> You might also like this:
>> Come on Monty - Lukas Smith http://bit.ly/5lmwwD
> 
> I've been watching some of this debate with interest, but I'll stay with a 
> database that has none of the baggage that MySQL has always had, and IS 
> currently replacing Oracle in many large sites :)
> 
> -- 
> Lester Caine - G8HFL

Do share your db of interest... (and please don't say MSSQL).

~Philip


--- End Message ---
--- Begin Message ---
On Mon, 2009-12-14 at 15:59 -0600, Philip Thompson wrote:

> On Dec 14, 2009, at 12:51 AM, Lester Caine wrote:
> 
> > Lenin wrote:
> >> You might also like this:
> >> Come on Monty - Lukas Smith http://bit.ly/5lmwwD
> > 
> > I've been watching some of this debate with interest, but I'll stay with a 
> > database that has none of the baggage that MySQL has always had, and IS 
> > currently replacing Oracle in many large sites :)
> > 
> > -- 
> > Lester Caine - G8HFL
> 
> Do share your db of interest... (and please don't say MSSQL).
> 
> ~Philip
> 
> 


MSSQL has nearly brought me to tears and could have easily made me bald
through hair pulling!

I have to say, I do like MySQL, it's very flexible and fast, and being
able to choose different storage engines for different tables in the
same DB is brilliant! I really don't think there's anything to overly
worry about from Oracle, as the two DB's have different audiences.

Thanks,
Ash
http://www.ashleysheridan.co.uk



--- End Message ---
--- Begin Message ---
On Dec 14, 2009, at 2:14 AM, Angelo Zanetti wrote:

> Hi all, 
> 
> I know there are a lot of scripts that one can pay for, for "live chat" -
> website support.
> 
> Are there are any free open source ones that work well?
> 
> I found: www.phplivechat.com
> 
> But still waiting to evaluate it.
> 
> Please send you comments, good or bad and what you would recommend or not
> recommend and why
> 
> Thanks in advance.
> 
> Angelo

We used phplivechat at my last company. I'm pretty sure I was the one who set 
it up, and I don't remember hating it. It seemed to work pretty reliably and 
our customers seemed to have enjoyed it. I'd recommend it.

~Philip

--- End Message ---
--- Begin Message ---
On Dec 14, 2009, at 4:27 AM, Ali Asghar Toraby Parizy wrote:

> Hi
> I think the best choice is jquery until now.
> But, is it reasonable to combine jquery and other library to client
> side and server side scripting respectively?
> By the way, where i can find good lessons about jquery and php?

I really like this js library.

http://mootools.net/

It's based off of jquery or prototype... I can't remember.

~Philip

--- End Message ---
--- Begin Message ---
Hello all.

My head hurts from hitting it on my desk all day, so I thought I'd turn to a 
fresher set of eyes. The issue I'm having is getting PHP to connect ODBC. I can 
get it to work using isql from the command line. Can you verify my settings....:

/etc/odbc.ini:

[MySQL]
Description     = MySQL 3.51 ODBC driver
Driver          = MySQL
Host            = s-irv-web02
Server          = s-irv-web02
UID             = user
Password        = pass
Database        = clients
Port            = 3306

/etc/odbcinst.ini:

[MySQL]
Description     = ODBC 3.51 for MySQL
Driver          = /usr/lib/libmyodbc3.so
Setup           = /usr/lib/libodbcmyS.so
FileUsage       = 1
UsageCount      = 2

Again, isql allows me to connect with the same settings as above: isql MySQL 
user pass

I've tried several settings in PHP to attempt to connect to it. All have been 
fruitless:

<?php
$user = 'user';
$pass = 'pass';
$dsn = "Driver={MySQL};Server=s-irv-web02;Host=s-irv-web02;";
$dsn = "Driver={MySQL 3.51 ODBC driver};Server=s-irv-web02;Host=s-irv-web02;";
$dsn = 
"Driver={MySQL};Server=s-irv-web02;Host=s-irv-web02;User=$user;Password=$pass";
odbc_connect ($dsn, $user, $pass);
?>

I've tried the above DSNs and many other versions of it ad nauseum. The 
specific error I'm getting is... "[unixODBC][Driver Manager]Data source name 
not found, and no default driver specified." I really have searched high and 
low for a solution, but to no avail. Any thoughts?

Thanks in advance,
~Philip

--- End Message ---
--- Begin Message ---
I'm looking for a way to strip HTML tags out of some text content
(sourced from a web page) to leave just the text which I'll be running
some basic analysis on. The thing is, I want to preserve text that is in
alt and title attributes. I can't use any DOM functions, as I can't
guarantee that the content will be valid XHTML, although it should be
valid HTML.

I'm happy doing this with string functions and regular expressions, but
I was wondering if something for this already existed? The server I plan
on putting this on does not have access to the shell (although it is a
Linux server) so I won't be able to have Lynx or Elinks parse the
content for me either :(

Thanks,
Ash
http://www.ashleysheridan.co.uk



--- End Message ---
--- Begin Message ---
Hey everyone, I just delved into classes recently and have been having
moderate success so far.

I have a puzzler though.

I have the following class decalred and instantiated:

class Notify {
 var $q = array();

 public function addtoQ($string, $class)
 {
  $message = '<span class="'. $class .'">'. $string .'</span>';
  $this->q[] = $message;
 }

 public function printQ()
 {
  if (isset($q))
  {
   echo '<p align="center" class="notification">';
   foreach($this->q as $msg)
   {
    echo $msg ."\n";
   }
   echo '</p>';
  }

  return;
 }

 function __destruct()
 {
  if (isset($q))
  {
   unset($this->q);
  }
 }
} // END CLASS Notify


And in my script, I call it like so:
$Notif = new Notify;

I have run other statements in other classes that should be adding to the $q
array (ie. Notify::addtoQ('ERROR! There Was An Error Updating The
Database!', 'error');)

However, when I try to get my webpage to display them using:

$Notify->printQ();

it does not seem to want to loop through this array (and print the
messages). I am getting NO error message, in fact everything 'looks' fine,
I'm just not seeing the appropriate message.

Any help would be appreicated!

--- End Message ---

Reply via email to