php-general Digest 18 Aug 2009 18:53:54 -0000 Issue 6292
Topics (messages 296909 through 296940):
Re: daemon without pcntl_fork
296909 by: Jim Lucas
296910 by: Lars Torben Wilson
296911 by: Per Jessen
296920 by: Lars Torben Wilson
296921 by: Per Jessen
HTML text extraction
296912 by: leledumbo
296913 by: Ashley Sheridan
296915 by: Richard Heyes
Re: File or directory?
296914 by: Clancy
296916 by: Ollisso
296917 by: Ashley Sheridan
Help on pregreplace
296918 by: Merlin Morgenstern
296919 by: Ashley Sheridan
296923 by: Al
296926 by: Merlin Morgenstern
296927 by: Tom Worster
296928 by: Vladan Stefanovic
DB Question | A hotel reservation scenario
296922 by: Behzad
296924 by: Ashley Sheridan
296925 by: Bastien Koert
296929 by: Arno Kuhl
296930 by: Ralph Deffke
296933 by: Behzad
296934 by: Ashley Sheridan
296940 by: Floyd Resler
getting the search words from a google query
296931 by: MURTUZA KUTUB Â
296932 by: Ashley Sheridan
Undefined Offset Error with Pagination and Sessions
296935 by: Miller, Terion
296936 by: Miller, Terion
296937 by: Shawn McKenzie
296938 by: Miller, Terion
296939 by: Ralph Deffke
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 ---
Lars Torben Wilson wrote:
2009/8/17 Jim Lucas <[email protected]>:
Does anybody know how to use PHP as a daemon without the use of pcntl_fork.
http://php.net/pcntl_fork
Hi Jim,
AFAIK you can't. Read on. . .
I don't want to have to have a person have a special/custom compilation
of PHP just to run a simple daemon.
My system: OpenBSD 4.5 w/PHP v5.2.8
I want to launch a daemon out of the /etc/rc.local when the system starts.
My goal is to write a script that will be launched from /etc/rc.local
when a system boots. I want it to be detached from any shell or ssh
login that I launch it from also.
Anybody have any idea on how to do this?
I have played with system() and it does work.
What you've done below is not create a daemon, but a background
process. It's still attached to the shell you started it in (try
killing the shell you started it from and see what happens). There are
other differences too. IMHO the approach you've used here does have
its uses, and I've used it (and still do) when it's appropriate, but
when what you need is a daemon, then faking it with a background
process just isn't enough.
Compiling in pcntl isn't really that big of a deal--depending on
exactly what you're trying to accomplish. Why is it a problem in your
case? Perhaps there is another way around the issue which has a
cleaner solution. For the cases I've run into, pcntl has worked
admirably.
I want this to be a system that works out of the box. For the most part.
I am expecting to have phone system vendors and low-level IT personal trying to
install this thing.
I don't want to have to field tons of questions on "How do I compile this
p&#*(_fork thing into PHP?
Anyways, could I compile a customer build of the php cli and include that into
my package?
Would things be statically links to the binary. ie every thing it needed would be built into it.
Or would I have to rip out as much as possible to make sure that it was compatible with a persons
system?
Thanks for the input!
test.php:
<?php
echo 'Starting';
system('/usr/local/bin/php test_cli.php >/dev/null &');
echo 'Done';
?>
test_cli.php
<?php
for( $i=1; $i<=10; $i++ ) {
echo "Echo {$i}\n";
sleep(1);
}
echo 'Done';
?>
The above, when called, launches test_cli.php and detaches it from the
cli and returns to the system prompt
Well, after writing all this out, I think I have answered by own question.
If anybody else has a better suggestion, I am all ears.
If you have a better way of doing it, please share.
Also, a second piece to this would be a script to manage
(start/stop/restart/etc...) the parent daemon.
Something along the line of apachectl or similar.
TIA!
Update to the last email also.
I found another device that does RS232 to ethernet:
http://www.hw-group.com/products/portstore2/index_en.html
Anybody work with one of these?
Not me. But I've solved similar problems using ser2net (see
http://sourceforge.net/projects/ser2net/ ), sometimes running it on a
small embedded Linux device. Works great and I don't have to pay
someone else to sell me a free solution. :) But again, it depends on
your actual situation and what problem you're trying to solve. On the
face of it the device you linked looks OK. (I'm afraid I missed your
earlier post on the topic.)
Again, thanks!
Jim Lucas
I'm not trying to shoot down any ideas you've had or anything, just
wondering what's so bad about compiling pcntl in and hoping that maybe
you can save a few bucks on the serial-to-network problem by making
use of existing free software. Post more about what your situation is
and who knows? Maybe a fakey-daemon using background processes and a
proprietary serial-to-network device really is the best answer for
you.
Either way, good luck!
Regards,
Torben
--
Jim Lucas
"Some men are born to greatness, some achieve greatness,
and some have greatness thrust upon them."
Twelfth Night, Act II, Scene V
by William Shakespeare
--- End Message ---
--- Begin Message ---
2009/8/17 Jim Lucas <[email protected]>:
> I want this to be a system that works out of the box. For the most part.
>
> I am expecting to have phone system vendors and low-level IT personal trying
> to install this thing.
>
> I don't want to have to field tons of questions on "How do I compile this
> p&#*(_fork thing into PHP?
>
> Anyways, could I compile a customer build of the php cli and include that
> into my package?
Certainly! You haven't mentioned how you intend to package it though,
so that "Certainly!" does come with some caveats. But including pcntl
is no different from including any other extension--in fact, the
chances of the target system being able to deal with it are greater,
if anything. If you compile it in, it'll be there. However, if it's
going to be limited to the point that you're including binaries only
for a specific platform, then A) compiling it in is no big deal, and
B) perhaps you should be looking at how you're packaging the thing.
> Would things be statically links to the binary. ie every thing it needed
> would be built into it. Or would I have to rip out as much as possible to
> make sure that it was compatible with a persons system?
Not sure what you mean by that, but if the target audience isn't
competent to deal with this, then your support calls are going to hurt
either way. :) Which is why I said perhaps you should be looking at
how you're packaging it. Anything you compile on one system is going
to require some forethought in order to make it broadly applicable on
other systems, but any relevant system should be able to handle the
basics such as process control.
Regards,
Torben
--- End Message ---
--- Begin Message ---
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?
On an openSUSE system I would just use 'startproc', but elsewhere you
could use setsid or nohup. I.e. create your CLI script with a
hash-bang, then start it
nohup <script> 2>&1 1>/dev/null &
/Per
--
Per Jessen, Zürich (21.6°C)
--- End Message ---
--- Begin Message ---
2009/8/18 Per Jessen <[email protected]>:
> 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?
>
> On an openSUSE system I would just use 'startproc', but elsewhere you
> could use setsid or nohup. I.e. create your CLI script with a
> hash-bang, then start it
>
> nohup <script> 2>&1 1>/dev/null &
>
>
> /Per
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 output have been
redirected), and a fully-implemented daemon will typically perform
other tasks which make it a good system citizen, such as: becoming
session leader, chroot'ing to / so that the filesystem it was started
from can be unmounted if necessary, and so on.
The difference may or may not be important, depending on the task at
hand. However, if an admin thinks he's got a daemon on his hands he
may wonder why things behave weird if what he really has is just
something which fakes it with & and nohup, since none of the important
daemon housekeeping has been dealt with.
Torben
--- End Message ---
--- Begin Message ---
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 output have been
> redirected), and a fully-implemented daemon will typically perform
> other tasks which make it a good system citizen, such as: becoming
> session leader, chroot'ing to / so that the filesystem it was started
> from can be unmounted if necessary, and so on.
Torben, you're really just splitting hairs - the OP didn't ask for the
definition of "daemon', he just wanted a script to run continually as
if it was a daemon. Besides, I did also suggest using either setsid or
openSUSEs startproc.
/Per
--
Per Jessen, Zürich (28.5°C)
--- End Message ---
--- Begin Message ---
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:
<p>
bla bla bla
<ul>
<li>item 1</li>
<li>item 2</li>
<li>item 3</li>
</ul>
</p>
and I take the first 40 characters, it would result in:
<p>
bla bla bla
<ul>
<li>item
As you can see, the tags are incomplete and it might break other texts below
it (I mean, other than this preview). I need a way to solve this problem.
--
View this message in context:
http://www.nabble.com/HTML-text-extraction-tp25020687p25020687.html
Sent from the PHP - General mailing list archive at Nabble.com.
--- End Message ---
--- Begin Message ---
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:
>
> <p>
> bla bla bla
> <ul>
> <li>item 1</li>
> <li>item 2</li>
> <li>item 3</li>
> </ul>
> </p>
>
> and I take the first 40 characters, it would result in:
>
> <p>
> bla bla bla
> <ul>
> <li>item
>
> As you can see, the tags are incomplete and it might break other texts below
> it (I mean, other than this preview). I need a way to solve this problem.
>
> --
> View this message in context:
> http://www.nabble.com/HTML-text-extraction-tp25020687p25020687.html
> Sent from the PHP - General mailing list archive at Nabble.com.
>
>
You could do a couple of things:
* Extract all the content and use strip_tags() to remove all the
HTML markup. In the example you gave it might look a bit odd if
the content suggests it was originally a list.
* Access the extracted content through the DOM, and grab the
textual content you need using node values. That way, you can
limit it to a specific character count of content, and with a
bit of work, you can preserve the original markup tags too
Thanks,
Ash
http://www.ashleysheridan.co.uk
--- End Message ---
--- Begin Message ---
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
--- End Message ---
--- Begin Message ---
On Sun, 16 Aug 2009 23:24:05 -0600, [email protected] (George Langley)
wrote:
>is_dir()
>
><http://ca3.php.net/is_dir>
>
>is_file()
>
><http://ca3.php.net/manual/en/function.is-file.php>
>
I specifically asked about FTP under PHP. As far as I can see neither of these
references
have anything to do with FTP.
--- End Message ---
--- Begin Message ---
On Tue, 18 Aug 2009 13:00:37 +0300, Clancy <[email protected]> wrote:
On Sun, 16 Aug 2009 23:24:05 -0600, [email protected] (George
Langley) wrote:
is_dir()
<http://ca3.php.net/is_dir>
is_file()
<http://ca3.php.net/manual/en/function.is-file.php>
I specifically asked about FTP under PHP. As far as I can see neither
of these references
have anything to do with FTP.
http://ca3.php.net/manual/en/wrappers.ftp.php
Supports stat() No As of PHP 5.0.0: filesize(), filetype(), file_exists(),
is_file(), and is_dir() elements only. As of PHP 5.1.0: filemtime().
should work if PHP >= 5.0.0
--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
--- End Message ---
--- Begin Message ---
On Tue, 2009-08-18 at 13:30 +0300, Ollisso wrote:
> On Tue, 18 Aug 2009 13:00:37 +0300, Clancy <[email protected]> wrote:
>
> > On Sun, 16 Aug 2009 23:24:05 -0600, [email protected] (George
> > Langley) wrote:
> >
> >> is_dir()
> >>
> >> <http://ca3.php.net/is_dir>
> >>
> >> is_file()
> >>
> >> <http://ca3.php.net/manual/en/function.is-file.php>
> >>
> > I specifically asked about FTP under PHP. As far as I can see neither
> > of these references
> > have anything to do with FTP.
> >
>
> http://ca3.php.net/manual/en/wrappers.ftp.php
>
> Supports stat() No As of PHP 5.0.0: filesize(), filetype(),
> file_exists(),
> is_file(), and is_dir() elements only. As of PHP 5.1.0: filemtime().
>
> should work if PHP >= 5.0.0
>
> --
> Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
>
That only works if you have used the file wrapper functions to open the
remote FTP connection. Some FTP hosts don't support the use of these
wrappers I believe also.
What is wrong with using ftp_rawlist() ?
Thanks,
Ash
http://www.ashleysheridan.co.uk
--- End Message ---
--- Begin Message ---
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";
$replace = '<span style="background:#FF0000;color:#FCCCCC;">\\1</span>';
return preg_replace($pattern,$replace,$str);
Thank you in advance,
Merlin
--- End Message ---
--- Begin Message ---
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
> someone help?
>
> Here is the code:
>
>
> $pattern = "/\b($words)\b/is";
> $replace = '<span style="background:#FF0000;color:#FCCCCC;">\\1</span>';
> return preg_replace($pattern,$replace,$str);
>
> Thank you in advance,
>
> Merlin
>
Well, a slash has a special meaning inside PHP strings, more so for
double quoted strings. Are you correctly escaping the slash as a double
slash so that it's not interpreted by the string as an escaped
character, as you will need to as the preg_replace will be interpreting
it as an escape sequence to match?
Thanks,
Ash
http://www.ashleysheridan.co.uk
--- End Message ---
--- Begin Message ---
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:
$pattern = "/\b($words)\b/is";
$replace = '<span style="background:#FF0000;color:#FCCCCC;">\\1</span>';
return preg_replace($pattern,$replace,$str);
Thank you in advance,
Merlin
best insurance
http://us2.php.net/manual/en/function.preg-quote.php
--- End Message ---
--- Begin Message ---
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 fix. Can
someone help?
Here is the code:
$pattern = "/\b($words)\b/is";
$replace = '<span style="background:#FF0000;color:#FCCCCC;">\\1</span>';
return preg_replace($pattern,$replace,$str);
Thank you in advance,
Merlin
Well, a slash has a special meaning inside PHP strings, more so for
double quoted strings. Are you correctly escaping the slash as a double
slash so that it's not interpreted by the string as an escaped
character, as you will need to as the preg_replace will be interpreting
it as an escape sequence to match?
Thanks,
Ash
http://www.ashleysheridan.co.uk
HI, replacing the delimiter slash by ~ solved the problem. Thank you
--- End Message ---
--- Begin Message ---
On 8/18/09 10:56 AM, "Merlin Morgenstern" <[email protected]> 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 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";
>>> $replace = '<span style="background:#FF0000;color:#FCCCCC;">\\1</span>';
>>> return preg_replace($pattern,$replace,$str);
>>>
>>> Thank you in advance,
>>>
>>> Merlin
>>>
>> Well, a slash has a special meaning inside PHP strings, more so for
>> double quoted strings. Are you correctly escaping the slash as a double
>> slash so that it's not interpreted by the string as an escaped
>> character, as you will need to as the preg_replace will be interpreting
>> it as an escape sequence to match?
>>
>> Thanks,
>> Ash
>> http://www.ashleysheridan.co.uk
>>
>>
>>
> HI, replacing the delimiter slash by ~ solved the problem. Thank you
which means that words with ~ in them will fail. as Al pointed out,
preg_quote() is a more general solution. it escapes all tricky pcre
characters as well as the delimiter.
--- End Message ---
--- Begin Message ---
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" <[email protected]> wrote in message
news:[email protected]...
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";
$replace = '<span
style="background:#FF0000;color:#FCCCCC;">\\1</span>';
return preg_replace($pattern,$replace,$str);
Thank you in advance,
Merlin
--- End Message ---
--- Begin Message ---
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 number of rooms that were busy during the last week
?
I would appreciate if you take a brief moment of your time and share your
opinion.
Thank you in advance,
-b
--- End Message ---
--- Begin Message ---
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 retrieve number of Free rooms at the current time.
> But how can I count the number of rooms that were busy during the last week
> ?
>
> I would appreciate if you take a brief moment of your time and share your
> opinion.
>
> Thank you in advance,
> -b
Keep a table that lists all the rooms along with their current status
Keep another table that has these fields:
* room_id (the id from above table)
* status (enumerated value - 'busy','reserved')
* start_date
* end_date
Then you perform your query using a join of these two tables, within a
particular date range. I've left out 'free' from the second table
because there's no point updating the table for a period if a room is
not being used.
You could also have start_date and end_date as datetime fields, as every
hotel i've ever been in has a set time for check-in and another for
check-out.
Thanks,
Ash
http://www.ashleysheridan.co.uk
--- End Message ---
--- Begin Message ---
On Tue, Aug 18, 2009 at 10:45 AM, Behzad<[email protected]> 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 number of Free rooms at the current time.
> But how can I count the number of rooms that were busy during the last week
> ?
>
> I would appreciate if you take a brief moment of your time and share your
> opinion.
>
> Thank you in advance,
> -b
>
query using the BUSY status as a parameter? But really you haven't
given enough to ascertain whether the structure is set to allow this
to happen
--
Bastien
Cat, the other other white meat
--- End Message ---
--- Begin Message ---
-----Original Message-----
From: Behzad [mailto:[email protected]]
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, 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 number of rooms that were busy during the last week
?
I would appreciate if you take a brief moment of your time and share your
opinion.
Thank you in advance,
-b
---------
You get that information from the history table. I presume there is some
sort of a history table?
Cheers
Arno
--- End Message ---
--- Begin Message ---
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 calculated and
then go from there. it would be the same calculation, just with backwards
dates.
hope that helps
[email protected]
"Behzad" <[email protected]> wrote in message
news:[email protected]...
> 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 number of rooms that were busy during the last
week
> ?
>
> I would appreciate if you take a brief moment of your time and share your
> opinion.
>
> Thank you in advance,
> -b
>
--- End Message ---
--- Begin Message ---
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 (enumerated value - 'busy','reserved')
The problem is to generate a graph to display status of rooms in different
periods of
time (daily, weekly, monthly).
X Axis = Status (Busy, Reserved)
Y Axis = Number of rooms with a certain status (the last status for each
room makes sense)
On Tue, Aug 18, 2009 at 8:13 PM, Ralph Deffke <[email protected]> wrote:
> 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 calculated and
> then go from there. it would be the same calculation, just with backwards
> dates.
>
> hope that helps
>
> [email protected]
>
>
>
> "Behzad" <[email protected]> wrote in message
> news:[email protected]...
> > 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 number of rooms that were busy during the last
> week
> > ?
> >
> > I would appreciate if you take a brief moment of your time and share your
> > opinion.
> >
> > Thank you in advance,
> > -b
> >
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
Kind regards,
-behzad
--- End Message ---
--- Begin Message ---
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 (the id from above table)
> - status_modified_on (date)
> - status (enumerated value - 'busy','reserved')
>
> The problem is to generate a graph to display status of rooms in different
> periods of
> time (daily, weekly, monthly).
> X Axis = Status (Busy, Reserved)
> Y Axis = Number of rooms with a certain status (the last status for each
> room makes sense)
>
>
> On Tue, Aug 18, 2009 at 8:13 PM, Ralph Deffke <[email protected]> wrote:
>
> > 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 calculated and
> > then go from there. it would be the same calculation, just with backwards
> > dates.
> >
> > hope that helps
> >
> > [email protected]
> >
> >
> >
> > "Behzad" <[email protected]> wrote in message
> > news:[email protected]...
> > > 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 number of rooms that were busy during the last
> > week
> > > ?
> > >
> > > I would appreciate if you take a brief moment of your time and share your
> > > opinion.
> > >
> > > Thank you in advance,
> > > -b
> > >
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
>
You should add a 'free' type to the first table (just the first one) to
indicate whether a room is free or not also.
As for counting the number of rooms that were busy last week, think
about what that actually means. Does that mean all rooms that were busy
the entire time, all rooms that were busy at least part of the time
during that week, etc?
Thanks,
Ash
http://www.ashleysheridan.co.uk
--- End Message ---
--- Begin Message ---
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-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 number of rooms that were busy during the
last week
?
I would appreciate if you take a brief moment of your time and share
your
opinion.
Thank you in advance,
-b
--- End Message ---
--- Begin Message ---
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 not sure how it is used etc.
if possible plz send me a small snippet as an example.
cheers.
-------------------------------------------------
Bits-Pilani Goa Campus (http://www.bits-goa.ac.in)
--- End Message ---
--- Begin Message ---
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 query from the entire url.
> i think parse function is used for it but i am not sure how it is used etc.
>
> if possible plz send me a small snippet as an example.
>
> cheers.
>
> -------------------------------------------------
> Bits-Pilani Goa Campus (http://www.bits-goa.ac.in)
>
>
Have you looked at the URL strings themselves? You can see that with a
Google query, the search words appear as part of the q= part of the
string.
Thanks,
Ash
http://www.ashleysheridan.co.uk
--- End Message ---
--- Begin Message ---
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 seems to mess up the code
formatting: http://pastebin.ca/1534024
Thanks to any and all who have a look.
Terion
--- End Message ---
--- Begin Message ---
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) but I know that checking if a sesion is set then immediately
unsetting it is not logical, and I tried putting it like if isset else unset
but same results, nothing work all variables error'd out as undefined.
On 8/18/09 11:49 AM, "Miller, Terion" <[email protected]> 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 posted here since my email client seems to mess up the code
formatting: http://pastebin.ca/1534024
Thanks to any and all who have a look.
Terion
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
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 posted here since my email client seems to mess up the code
> formatting: http://pastebin.ca/1534024
>
> Thanks to any and all who have a look.
> Terion
>
First off the $_SESSION array doesn't exist because you haven't started
the session with session_start().
--
Thanks!
-Shawn
http://www.spidean.com
--- End Message ---
--- Begin Message ---
On 8/18/09 12:44 PM, "Shawn McKenzie" <[email protected]> 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 the
> "undefined offset error"
>
> The page code is posted here since my email client seems to mess up the code
> formatting: http://pastebin.ca/1534024
>
> Thanks to any and all who have a look.
> Terion
>
First off the $_SESSION array doesn't exist because you haven't started
the session with session_start().
--
Thanks!
-Shawn
http://www.spidean.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Oh Sorry for confusion but yes the session_start() is at the very very top of
the page along with a bunch of other data connection stuff, I just didn't
include in the troublesome script.
--- End Message ---
--- Begin Message ---
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 trust the session vars any more anyway.
[email protected]
""Miller, Terion"" <[email protected]> wrote in message
news:c6b04cb6.49e1%[email protected]...
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) but I know that checking if a sesion is set
then immediately unsetting it is not logical, and I tried putting it like if
isset else unset but same results, nothing work all variables error'd out
as undefined.
On 8/18/09 11:49 AM, "Miller, Terion" <[email protected]> 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 posted here since my email client seems to mess up the code
formatting: http://pastebin.ca/1534024
Thanks to any and all who have a look.
Terion
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---