Re: [PHP] daemon without pcntl_fork

2009-08-18 Thread Per Jessen
Jim Lucas wrote: > Does anybody know how to use PHP as a daemon without the use of > pcntl_fork. > Sure. Just start it and leave it running. > I want to launch a daemon out of the /etc/rc.local when the system > starts. Yep, I do that all the time. > Anybody have any idea on how to do this?

[PHP] HTML text extraction

2009-08-18 Thread leledumbo
Usually, a website gives preview of its articles by extracting some of the first characters. This is easy if the article is a pure text, but what if it's a HTML text? For instance, if I have the full text: bla bla bla item 1 item 2 item 3 and I take the first 40 characters,

Re: [PHP] HTML text extraction

2009-08-18 Thread Ashley Sheridan
On Tue, 2009-08-18 at 01:37 -0700, leledumbo wrote: > Usually, a website gives preview of its articles by extracting some of the > first characters. This is easy if the article is a pure text, but what if > it's a HTML text? For instance, if I have the full text: > > > bla bla bla > > it

Re: [PHP] Re: File or directory?

2009-08-18 Thread Clancy
On Sun, 16 Aug 2009 23:24:05 -0600, george.lang...@shaw.ca (George Langley) wrote: >is_dir() > > > >is_file() > > > I specifically asked about FTP under PHP. As far as I can see neither of these references have anythi

Re: [PHP] HTML text extraction

2009-08-18 Thread Richard Heyes
HI, > ... The easy way (Back to the Future 2 anyone...?) would be to use strip_tags() first: http://uk.php.net/strip_tags -- Richard Heyes HTML5 graphing: RGraph - www.rgraph.net (updated 8th August) Lots of PHP and Javascript code - http://www.phpguru.org -- PHP General Mailing List (http:/

Re: [PHP] Re: File or directory?

2009-08-18 Thread Ollisso
On Tue, 18 Aug 2009 13:00:37 +0300, Clancy wrote: On Sun, 16 Aug 2009 23:24:05 -0600, george.lang...@shaw.ca (George Langley) wrote: is_dir() is_file() I specifically asked about FTP under PHP. As far as I

Re: [PHP] Re: File or directory?

2009-08-18 Thread Ashley Sheridan
On Tue, 2009-08-18 at 13:30 +0300, Ollisso wrote: > On Tue, 18 Aug 2009 13:00:37 +0300, Clancy wrote: > > > On Sun, 16 Aug 2009 23:24:05 -0600, george.lang...@shaw.ca (George > > Langley) wrote: > > > >> is_dir() > >> > >> > >> > >> is_file() > >> > >>

[PHP] Help on pregreplace

2009-08-18 Thread Merlin Morgenstern
Hi there, I am highlighting keywords with the help of pregreplace. This works great with one limitation. If the word that has to be replaced contains a slash, preg throws an error. So far I could not find a fix. Can someone help? Here is the code: $pattern = "/\b($words)\b/is";

Re: [PHP] Help on pregreplace

2009-08-18 Thread Ashley Sheridan
On Tue, 2009-08-18 at 16:00 +0200, Merlin Morgenstern wrote: > Hi there, > > I am highlighting keywords with the help of pregreplace. This works > great with one limitation. If the word that has to be replaced contains > a slash, preg throws an error. So far I could not find a fix. Can > someon

Re: [PHP] daemon without pcntl_fork

2009-08-18 Thread Lars Torben Wilson
2009/8/18 Per Jessen : > Jim Lucas wrote: > >> Does anybody know how to use PHP as a daemon without the use of >> pcntl_fork. >> > > Sure. Just start it and leave it running. > >> I want to launch a daemon out of the /etc/rc.local when the system >> starts. > > Yep, I do that all the time. > >> Any

Re: [PHP] daemon without pcntl_fork

2009-08-18 Thread Per Jessen
Lars Torben Wilson wrote: > Again, that's not a daemon. If it is sufficient to run a background > process then that's fine, but that doesn't make it a daemon (although > it shares some things in common with a daemon). The background process > still has a controlling terminal (even if input and out

[PHP] DB Question | A hotel reservation scenario

2009-08-18 Thread Behzad
Dear list, e-Greetings! I'm faced with an interesting and challenging problem. Consider a database, designed for a hotel. At any given time, each room has a different status: It's Busy or Reserved, or Free. It's easy to retrieve number of Free rooms at the current time. But how can I count the n

[PHP] Re: Help on pregreplace

2009-08-18 Thread Al
Merlin Morgenstern wrote: Hi there, I am highlighting keywords with the help of pregreplace. This works great with one limitation. If the word that has to be replaced contains a slash, preg throws an error. So far I could not find a fix. Can someone help? Here is the code: $patte

Re: [PHP] DB Question | A hotel reservation scenario

2009-08-18 Thread Ashley Sheridan
On Tue, 2009-08-18 at 19:15 +0430, Behzad wrote: > Dear list, > e-Greetings! > > I'm faced with an interesting and challenging problem. > > Consider a database, designed for a hotel. > At any given time, each room has a different status: It's Busy or Reserved, > or Free. > > It's easy to retriev

Re: [PHP] DB Question | A hotel reservation scenario

2009-08-18 Thread Bastien Koert
On Tue, Aug 18, 2009 at 10:45 AM, Behzad wrote: > Dear list, > e-Greetings! > > I'm faced with an interesting and challenging problem. > > Consider a database, designed for a hotel. > At any given time, each room has a different status: It's Busy or Reserved, > or Free. > > It's easy to retrieve nu

Re: [PHP] Help on pregreplace

2009-08-18 Thread Merlin Morgenstern
Ashley Sheridan wrote: On Tue, 2009-08-18 at 16:00 +0200, Merlin Morgenstern wrote: Hi there, I am highlighting keywords with the help of pregreplace. This works great with one limitation. If the word that has to be replaced contains a slash, preg throws an error. So far I could not find a

Re: [PHP] Help on pregreplace

2009-08-18 Thread Tom Worster
On 8/18/09 10:56 AM, "Merlin Morgenstern" wrote: > > > Ashley Sheridan wrote: >> On Tue, 2009-08-18 at 16:00 +0200, Merlin Morgenstern wrote: >>> Hi there, >>> >>> I am highlighting keywords with the help of pregreplace. This works >>> great with one limitation. If the word that has to be repl

[PHP] Re: Help on pregreplace

2009-08-18 Thread Vladan Stefanovic
You should check out preg_quote() function which puts a backslash in front of characters (escapes them) that have a special meaning in regular expressions. Regards, Vladan Stefanovic "Merlin Morgenstern" wrote in message news:12.62.22194.004ba...@pb1.pair.com... Hi there, I am highlightin

RE: [PHP] DB Question | A hotel reservation scenario

2009-08-18 Thread Arno Kuhl
-Original Message- From: Behzad [mailto:behzad.esl...@gmail.com] Sent: 18 August 2009 04:46 PM To: PHP General Mailing List Subject: [PHP] DB Question | A hotel reservation scenario Dear list, e-Greetings! I'm faced with an interesting and challenging problem. Consider a database, desig

[PHP] Re: DB Question | A hotel reservation scenario

2009-08-18 Thread Ralph Deffke
to answer this is in fact not possible on the base of information u give. I dont think there is a general db outlay for hotels. it depends how the "booking" tables are designed. does the application excist or u are doing a new one? if it excist, have a look how the availability of a room is calc

[PHP] getting the search words from a google query

2009-08-18 Thread MURTUZA KUTUB  
hey, i am a beginner at php and i need your help. i have a list of urls visited on a particular day in mysql database. using php i find out all the websites that have a google search. now i need to strip apart the google query from the entire url. i think parse function is used for it but i am no

Re: [PHP] getting the search words from a google query

2009-08-18 Thread Ashley Sheridan
On Tue, 2009-08-18 at 21:23 +0530, MURTUZA KUTUB Â wrote: > hey, > > i am a beginner at php and i need your help. > > i have a list of urls visited on a particular day in mysql database. > using php i find out all the websites that have a google search. > now i need to strip apart the google que

[PHP] Undefined Offset Error with Pagination and Sessions

2009-08-18 Thread Miller, Terion
Hi Folks, after days of trying lots of different things, I'm must grovel to the list and post my problem...which is I am unable to get my pagination to work, it seems to not carry the session to the next page and I get the "undefined offset error" The page code is posted here since my email client

Re: [PHP] Re: DB Question | A hotel reservation scenario

2009-08-18 Thread Ashley Sheridan
On Tue, 2009-08-18 at 21:02 +0430, Behzad wrote: > Based on Ashely's reply, I created the following scheme: > > The table "Rooms" has the following fields. > > - id (PK) > - room_no (varchar) > - status (ENUM: Busy, Reserved) > > the other table, "RoomLogs", has the following fields: > - room_id

Re: [PHP] Re: DB Question | A hotel reservation scenario

2009-08-18 Thread Behzad
Based on Ashely's reply, I created the following scheme: The table "Rooms" has the following fields. - id (PK) - room_no (varchar) - status (ENUM: Busy, Reserved) the other table, "RoomLogs", has the following fields: - room_id (the id from above table) - status_modified_on (date) - status (enum

Re: [PHP] Undefined Offset Error with Pagination and Sessions

2009-08-18 Thread Miller, Terion
Formatted as PHP http://pastebin.ca/1534058 and a note before I get chewed about the weird setting and unsetting at the top with the sessions...because believe I see it...but if you take the unset() out..nothing works, I can't figure that out and maybe that is a blatent thing I'm missing (prob

[PHP] Re: Undefined Offset Error with Pagination and Sessions

2009-08-18 Thread Shawn McKenzie
Miller, Terion wrote: > Hi Folks, after days of trying lots of different things, I'm must grovel to > the list and post my problem...which is I am unable to get my pagination to > work, it seems to not carry the session to the next page and I get the > "undefined offset error" > > The page code is

Re: [PHP] Re: Undefined Offset Error with Pagination and Sessions

2009-08-18 Thread Miller, Terion
On 8/18/09 12:44 PM, "Shawn McKenzie" wrote: Miller, Terion wrote: > Hi Folks, after days of trying lots of different things, I'm must grovel to > the list and post my problem...which is I am unable to get my pagination to > work, it seems to not carry the session to the next page and I get th

Re: [PHP] Undefined Offset Error with Pagination and Sessions

2009-08-18 Thread Ralph Deffke
by having a quick look on it, u have to work on a session base? otherwise it could be done by the post data only. I'm trying to avoid to work on the session, because it makes live a bit easier. if u can try. I'm telling this, because as u metioned to unset the session stuff is wierd and I wouldn't

Re: [PHP] DB Question | A hotel reservation scenario

2009-08-18 Thread Floyd Resler
I would create a room history table that contained three fields: room number, status, date stamp. Each time the status of a room changes insert a new record into the table with the current status and date/ time. Take care, Floyd On Aug 18, 2009, at 10:45 AM, Behzad wrote: Dear list, e-Gr

[PHP] Really quick try/catch question

2009-08-18 Thread Brian Dunning
I have a "new SimpleXMLElement()" that is occasionally throwing: 'Exception: String could not be parsed as XML' Will this catch it when it happens, or am I missing something? function domyfunction() { // This does some stuff to exit the script gracefully } try { $xmlobject = new

Re: [PHP] Really quick try/catch question

2009-08-18 Thread Nathan Nobbe
On Tue, Aug 18, 2009 at 1:29 PM, Brian Dunning wrote: > I have a "new SimpleXMLElement()" that is occasionally throwing: > 'Exception: String could not be parsed as XML' > > Will this catch it when it happens, or am I missing something? > > function domyfunction() { >// This does some stuf

[PHP] PHP and CGI

2009-08-18 Thread sono-io
I've searched high and low for an answer to this. Hopefully someone here might know. Can PHP be used under a CGI? I tried to put the following code on one of my perl shopping cart pages but it doesn't work: "; for ($year = date("Y") ; $year <= date("Y") + 8 ; $year++) { echo "$y

RE: [PHP] PHP and CGI

2009-08-18 Thread Daevid Vincent
> -Original Message- > From: sono...@fannullone.us [mailto:sono...@fannullone.us] > Sent: Tuesday, August 18, 2009 5:10 PM > To: PHP General List > Subject: [PHP] PHP and CGI > > I've searched high and low for an answer to this. > Hopefully someone > here might know. Can PHP

[PHP] Re: PHP and CGI

2009-08-18 Thread Shawn McKenzie
sono...@fannullone.us wrote: > I've searched high and low for an answer to this. Hopefully someone > here might know. Can PHP be used under a CGI? I tried to put the > following code on one of my perl shopping cart pages but it doesn't work: > > echo ""; > for ($year = date("Y") ; $year <=

Re: [PHP] daemon without pcntl_fork

2009-08-18 Thread Lars Torben Wilson
2009/8/18 Per Jessen : > Lars Torben Wilson wrote: > >> Again, that's not a daemon. If it is sufficient to run a background >> process then that's fine, but that doesn't make it a daemon (although >> it shares some things in common with a daemon). The background process >> still has a controlling t

Re: [PHP] Re: PHP and CGI

2009-08-18 Thread Shawn McKenzie
Andrew Mason wrote: > If you already have it written in Perl, I would recommend writing the > rest of functionality in Perl. > > Please reply all. I agree, but I assumed that the problem was that he knew PHP and he had downloaded a Perl cart and didn't know Perl. -Shawn -- PHP General Mail

Re: [PHP] Re: PHP and CGI

2009-08-18 Thread sono-io
On Aug 18, 2009, at 7:13 PM, Shawn McKenzie wrote: I assumed that the problem was that he knew PHP and he had downloaded a Perl cart and didn't know Perl. That's exactly the case. I have been running my business on a Perl cart for the last 5+ years, and I can't switch to a PHP cart just

Re: [PHP] Re: PHP and CGI

2009-08-18 Thread kranthi
try adding AddType application/x-httpd-php .pl --> or whatever extension your perl script has -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Undefined Offset Error with Pagination and Sessions

2009-08-18 Thread kranthi
may be you can use a couple of var_dumps to see what's happening behind the screens. and... use a debugger like xdebug.. it'll be of help -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] getting the search words from a google query

2009-08-18 Thread kranthi
can you provide a sample URL that you have in your mysql database ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php