php-general Digest 7 Dec 2002 15:46:03 -0000 Issue 1749

Topics (messages 127352 through 127377):

Re: mail() problems...
        127352 by: Anthony Ritter
        127372 by: Jason Wong
        127376 by: Anthony Ritter

Date again
        127353 by: Miguel Brás
        127356 by: Stephen
        127371 by: Jason Wong

Re: XSLT failing when DOCTYPE declaration present
        127354 by: Dave
        127355 by: Dave
        127368 by: Chris Wesley

Re: Help! Stuck! Perm denied w/ fopen.
        127357 by: Dave
        127375 by: psy berpunk

Re: Middle Number
        127358 by: Rick Widmer

Re: HOW GET ALL HTML CONTENT
        127359 by: Dave

Re: Repeating Decimals
        127360 by: Tom Rogers
        127377 by: Stephen

Humour me
        127361 by: John Taylor-Johnston
        127363 by: . Edwin
        127369 by: Jerry M. Howell II

Re: Generating forms using OOP
        127362 by: Peter J. Schoenster
        127367 by: Tom Rogers
        127373 by: Davy Obdam
        127374 by: Davy Obdam

Re: Output page cut off after 7000 characters
        127364 by: Tom Rogers

Re: PHP includes without access to the default directory
        127365 by: Tom Rogers

Re: Confused about $_SESSION and $_COOKIE scope..
        127366 by: Tom Rogers

Re: Allowed memory size exhausted
        127370 by: . Edwin

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 ---
To all who assisted me today.

I finally managed to get the mail () funtion to work.

Thank you and happy holidays to you all...
TR




--- End Message ---
--- Begin Message ---
On Saturday 07 December 2002 12:16, Anthony Ritter wrote:
> To all who assisted me today.
>
> I finally managed to get the mail () funtion to work.

Would you mind disclosing what you did to make it work? Those searching the 
archives in generations to come would appreciate what the conclusion was.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

/*
Reply hazy, ask again later.
*/

--- End Message ---
--- Begin Message ---
Jason Wong wrote:
> Would you mind disclosing what you did to make it work? Those searching
the
> archives in generations to come would appreciate what the conclusion was.
.................

Sure.

1. I put it the _correct _name of my ISP's mailserver.

No more errros.

However...that sent out the mail but I didn't receive it back.

Then...

2. I received a nice e-mail from Ms. Meloni explaining that I forget to
replace the string in the variable:

$to

with _my_ e-mail address - not _hers_.

She was getting my test e-mails.

Oh brother...
Happy holidays and thank you for your help.
TR




--- End Message ---
--- Begin Message ---
Ok guys,

having a problem here. I did my table with 6 fields, they are:
id  position  name  timein  timeout  date

I have a form to insert the info on the fields, and at the date field, I
have a drop down menu that returns me the next 7 days (the date in d/m/y),
people will choose the date they want and that will be stored on the table.

Now I want to retrieve the position, name, timein and timeout from by table
and display it on a page. But I want only the records for the present date.
I inserted the info on my table and on the date's field I inserted 07/12/02
and 06/12/02 just for testing

I called the data via a query: SELECT position, name, timein, timeout, date
FROM table WHERE date=NOW()
It was supposed that only the record from the present date was shown. But
not, I can't have anything. Only the custom message I did if nothing was
available

What is missing here? Looked at PHP manual, time, date mktime and so on
functions, but nothing.
Anybody for a hand?

One more thing, how can I do to prevent that different people apply for a
same position, on the same day and during the "shift" of the first one that
applied?

I mean, I decide to occupy the FSS position from 21:00 to 23:00 on 08th
Decemeber.
Someone come and try to apply also for FSS but from 19:00 to 20:30 or from
21:30 to 22:30. Since the position is occupied during a portion of the
requested time or during all the requested time, how can I prevent this to
be added on the table??

Thx
Miguel


--- End Message ---
--- Begin Message ---
Not sure but I think now() doesn't return the date formate you'd want
assuming your date section is classified as a date. Here's what I would do:

$date = date("Y-m-d");
$sql = "SELECT * FROM table WHERE date='".$date"'";
$result = mysql_query($sql, $connection);

Hope it works!


----- Original Message -----
From: "Miguel Brás" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, December 06, 2002 10:39 PM
Subject: [PHP] Date again


> Ok guys,
>
> having a problem here. I did my table with 6 fields, they are:
> id  position  name  timein  timeout  date
>
> I have a form to insert the info on the fields, and at the date field, I
> have a drop down menu that returns me the next 7 days (the date in d/m/y),
> people will choose the date they want and that will be stored on the
table.
>
> Now I want to retrieve the position, name, timein and timeout from by
table
> and display it on a page. But I want only the records for the present
date.
> I inserted the info on my table and on the date's field I inserted
07/12/02
> and 06/12/02 just for testing
>
> I called the data via a query: SELECT position, name, timein, timeout,
date
> FROM table WHERE date=NOW()
> It was supposed that only the record from the present date was shown. But
> not, I can't have anything. Only the custom message I did if nothing was
> available
>
> What is missing here? Looked at PHP manual, time, date mktime and so on
> functions, but nothing.
> Anybody for a hand?
>
> One more thing, how can I do to prevent that different people apply for a
> same position, on the same day and during the "shift" of the first one
that
> applied?
>
> I mean, I decide to occupy the FSS position from 21:00 to 23:00 on 08th
> Decemeber.
> Someone come and try to apply also for FSS but from 19:00 to 20:30 or from
> 21:30 to 22:30. Since the position is occupied during a portion of the
> requested time or during all the requested time, how can I prevent this to
> be added on the table??
>
> Thx
> Miguel
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--- End Message ---
--- Begin Message ---
On Saturday 07 December 2002 11:39, Miguel Brás wrote:
> Ok guys,
>
> having a problem here. I did my table with 6 fields, they are:
> id  position  name  timein  timeout  date
>
> I have a form to insert the info on the fields, and at the date field, I
> have a drop down menu that returns me the next 7 days (the date in d/m/y),
> people will choose the date they want and that will be stored on the table.
>
> Now I want to retrieve the position, name, timein and timeout from by table
> and display it on a page. But I want only the records for the present date.
> I inserted the info on my table and on the date's field I inserted 07/12/02
> and 06/12/02 just for testing
>
> I called the data via a query: SELECT position, name, timein, timeout, date
> FROM table WHERE date=NOW()
> It was supposed that only the record from the present date was shown. But
> not, I can't have anything. Only the custom message I did if nothing was
> available

NOW() returns the current date and TIME. Use CURRENT_DATE or CUR_DATE() to get 
just the date portion.

> One more thing, how can I do to prevent that different people apply for a
> same position, on the same day and during the "shift" of the first one that
> applied?

Check the archives, there was a thread in the last couple of days about 
"Checking for Overlapping Dates". The same principles should apply so it may 
be useful reading.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

/*
Abstainer, n.:
        A weak person who yields to the temptation of denying himself a
        pleasure.
                -- Ambrose Bierce, "The Devil's Dictionary"
*/

--- End Message ---
--- Begin Message ---
oops,

file permission problem, if it isn't set to right permissions, it won't read
and
act as if there wasn't one, which then makes it work. so it does look like
your doc
doesn't conform.

"Chris Wesley" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> On Wed, 4 Dec 2002, Dave wrote:
>
> Whoah ... was this reply sent several weeks ago when I sent the original
> message and I'm just getting it now, or was it sent just recently?
>
> > without seeing the specifics, and assuming that PHP is never wrong (in
the 4
> > years i've used it, it hasn't been!)... your xml doc doesn't conform to
> > the DTD. if you think this isn't the case, well, double check. if you
>
> Re-read my original message, and it's painfully obvious that I did
> check, and that the XML did in fact conform to the DTD I used.
> (The XSLT was fine when the DTD was referenced locally, rather than
> remotely.)
>
> > still feel it is an error, you may want to email a bug issue to the
> > sablotron people (i'm assuming that's what you're using).
>
> Yes, I used the Sablotron extension to PHP 4.2.2.  Thanks for the
> insightful advice ....
>
> ~Chris
>
> > "Chris Wesley" <[EMAIL PROTECTED]> wrote in message
> >
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > > I'm using the xslt capabilities in PHP 4.2.2 and running into an odd
> > > problem.  I'm transforming an XML document which has a DOCTYPE
> > > declaration referencing an external DTD.
> > >
> > > <!DOCTYPE RootNode SYSTEM "http://my.host.org/foo.dtd";>
> > >
> > > When I have xslt_process() attempt to transform the XML document, with
an
> > > XSL document I provide, it fails.  These are the errors I get back
from
> > > xslt_error() & xslt_errno.
> > >   error: XML parser error 4: not well-formed (invalid token).
> > >   errno: 2
> > >
> > > If I remove the DOCTYPE declaration from the XML, xslt_process() has
no
> > > problem transforming the XML.
> > >
> > > If I change the DOCTYPE declaration to:
> > > <!DOCTYPE RootNode SYSTEM "file:///path/to/docroot/foo.dtd">
> > > then xslt_process() has no problem transfoming the XML.
> > >
> > > However, I need to make this work with the external DTD reference
being to
> > > some other host (http://other.my.host.org/foo.dtd).
> > > Has anyone gotten this to work properly, have any insight into the
error
> > > information above, or know what I might have to do differently?
>
>


--- End Message ---
--- Begin Message ---
or either the permissions are wrong on the external site or the file doesn't
exist....

-dave

ps - just trying to give some quick advice hoping it would help, if you
don't appreciate it,
i can give you some "insightful advice" about what to go do with yourself.

"Dave" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> oops,
>
> file permission problem, if it isn't set to right permissions, it won't
read
> and
> act as if there wasn't one, which then makes it work. so it does look like
> your doc
> doesn't conform.
>
> "Chris Wesley" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > On Wed, 4 Dec 2002, Dave wrote:
> >
> > Whoah ... was this reply sent several weeks ago when I sent the original
> > message and I'm just getting it now, or was it sent just recently?
> >
> > > without seeing the specifics, and assuming that PHP is never wrong (in
> the 4
> > > years i've used it, it hasn't been!)... your xml doc doesn't conform
to
> > > the DTD. if you think this isn't the case, well, double check. if you
> >
> > Re-read my original message, and it's painfully obvious that I did
> > check, and that the XML did in fact conform to the DTD I used.
> > (The XSLT was fine when the DTD was referenced locally, rather than
> > remotely.)
> >
> > > still feel it is an error, you may want to email a bug issue to the
> > > sablotron people (i'm assuming that's what you're using).
> >
> > Yes, I used the Sablotron extension to PHP 4.2.2.  Thanks for the
> > insightful advice ....
> >
> > ~Chris
> >
> > > "Chris Wesley" <[EMAIL PROTECTED]> wrote in message
> > >
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > > > I'm using the xslt capabilities in PHP 4.2.2 and running into an odd
> > > > problem.  I'm transforming an XML document which has a DOCTYPE
> > > > declaration referencing an external DTD.
> > > >
> > > > <!DOCTYPE RootNode SYSTEM "http://my.host.org/foo.dtd";>
> > > >
> > > > When I have xslt_process() attempt to transform the XML document,
with
> an
> > > > XSL document I provide, it fails.  These are the errors I get back
> from
> > > > xslt_error() & xslt_errno.
> > > >   error: XML parser error 4: not well-formed (invalid token).
> > > >   errno: 2
> > > >
> > > > If I remove the DOCTYPE declaration from the XML, xslt_process() has
> no
> > > > problem transforming the XML.
> > > >
> > > > If I change the DOCTYPE declaration to:
> > > > <!DOCTYPE RootNode SYSTEM "file:///path/to/docroot/foo.dtd">
> > > > then xslt_process() has no problem transfoming the XML.
> > > >
> > > > However, I need to make this work with the external DTD reference
> being to
> > > > some other host (http://other.my.host.org/foo.dtd).
> > > > Has anyone gotten this to work properly, have any insight into the
> error
> > > > information above, or know what I might have to do differently?
> >
> >
>
>


--- End Message ---
--- Begin Message ---
no, that's not it.  everything was configured properly.  everything
conformed, except the xslt processor.  the correct people were contacted
many many weeks ago now.

        again, thanks for your time ...
        ~Chris

On Fri, 6 Dec 2002, Dave wrote:

> oops,
>
> file permission problem, if it isn't set to right permissions, it won't read
> and
> act as if there wasn't one, which then makes it work. so it does look like
> your doc
> doesn't conform.
>
> "Chris Wesley" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > On Wed, 4 Dec 2002, Dave wrote:
> >
> > Whoah ... was this reply sent several weeks ago when I sent the original
> > message and I'm just getting it now, or was it sent just recently?
> >
> > > without seeing the specifics, and assuming that PHP is never wrong (in
> the 4
> > > years i've used it, it hasn't been!)... your xml doc doesn't conform to
> > > the DTD. if you think this isn't the case, well, double check. if you
> >
> > Re-read my original message, and it's painfully obvious that I did
> > check, and that the XML did in fact conform to the DTD I used.
> > (The XSLT was fine when the DTD was referenced locally, rather than
> > remotely.)
> >
> > > still feel it is an error, you may want to email a bug issue to the
> > > sablotron people (i'm assuming that's what you're using).
> >
> > Yes, I used the Sablotron extension to PHP 4.2.2.  Thanks for the
> > insightful advice ....
> >
> > ~Chris
> >
> > > "Chris Wesley" <[EMAIL PROTECTED]> wrote in message
> > >
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > > > I'm using the xslt capabilities in PHP 4.2.2 and running into an odd
> > > > problem.  I'm transforming an XML document which has a DOCTYPE
> > > > declaration referencing an external DTD.
> > > >
> > > > <!DOCTYPE RootNode SYSTEM "http://my.host.org/foo.dtd";>
> > > >
> > > > When I have xslt_process() attempt to transform the XML document, with
> an
> > > > XSL document I provide, it fails.  These are the errors I get back
> from
> > > > xslt_error() & xslt_errno.
> > > >   error: XML parser error 4: not well-formed (invalid token).
> > > >   errno: 2
> > > >
> > > > If I remove the DOCTYPE declaration from the XML, xslt_process() has
> no
> > > > problem transforming the XML.
> > > >
> > > > If I change the DOCTYPE declaration to:
> > > > <!DOCTYPE RootNode SYSTEM "file:///path/to/docroot/foo.dtd">
> > > > then xslt_process() has no problem transfoming the XML.
> > > >
> > > > However, I need to make this work with the external DTD reference
> being to
> > > > some other host (http://other.my.host.org/foo.dtd).
> > > > Has anyone gotten this to work properly, have any insight into the
> error
> > > > information above, or know what I might have to do differently?
> >
> >
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--- End Message ---
--- Begin Message ---
i thought (could be wrong) that directories need execute to read within
them, files only need r+w,
to make a directory readable.. i always chmod 755 my directories and 644 my
files (or in your case
chmod 777 directories and 666 files, but i don't recommend that at all).

sometimes, i chgrp nobobdy [file/dir] and then 775 [dir] or 664 [file] so
that apache can have access,
and your user, but not anybody else. make sure that doesn't mess anything
else that might want access
locally up.


"Psy Berpunk" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I am running using php with apache and curl on a redhat machine.
> All the installs are very recent with recent versions.
> Processing of .phtml from the html directory is working great except:
>
> I am getting perm denied with fopen for a directory that is set to 666
> for permissions, and owned by the same user and group as specified in
> httpd.conf: apache
>
> Something strange is going on here, as I have verified and reverified
> the paths and httpd config and test code, and either 666 or ownership
> should
> be enough and I'm still getting permission denied.
>


--- End Message ---
--- Begin Message ---
That worked! Thank you!


Dave wrote:

> i thought (could be wrong) that directories need execute to read within
> them, files only need r+w,
> to make a directory readable.. i always chmod 755 my directories and 644 my
> files (or in your case
> chmod 777 directories and 666 files, but i don't recommend that at all).
>
> sometimes, i chgrp nobobdy [file/dir] and then 775 [dir] or 664 [file] so
> that apache can have access,
> and your user, but not anybody else. make sure that doesn't mess anything
> else that might want access
> locally up.
>
> "Psy Berpunk" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > I am running using php with apache and curl on a redhat machine.
> > All the installs are very recent with recent versions.
> > Processing of .phtml from the html directory is working great except:
> >
> > I am getting perm denied with fopen for a directory that is set to 666
> > for permissions, and owned by the same user and group as specified in
> > httpd.conf: apache
> >
> > Something strange is going on here, as I have verified and reverified
> > the paths and httpd config and test code, and either 666 or ownership
> > should
> > be enough and I'm still getting permission denied.
> >

--- End Message ---
--- Begin Message ---
At 09:45 PM 12/6/02 -0500, Stephen wrote:
How can you find the meadian (or middle number) of a list of numbers? If
there is an even amount of numbers, how would I still find it?

load the list into an array, in numeric order...

then:

$List = array( 1,2,3,4,5,6 );

$Middle = ( count( $List ) - 1 ) / 2;

$median = ( $List[ floor( $Middle ) ] + $List[ ceil( $Middle ) ] ) / 2;

--- End Message ---
--- Begin Message ---
not sure exactly what you mean, but try $HTTP_RAW_POST_DATA
or $_SERVER['HTTP_RAW_POST_DATA']

"Nice_boy" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> hi,
>
> who knows how to get all contents when i use javascript to get bookmark of
> IE
> ex:
>
> window.external.ImportExportFavoritesfalse,"http://localhost/test.php";);
>
> because  i use $_POST to get that data,but it can't get all data.
>
> if it has 27593 bytes ,then only get 7XXX bytes. that means so many data
was
> not geted.
>
> i got some informations when use $HTTP_SERVER_VARS, then data is
>
> [key=COMSPEC]=value[C:\\WINDOWS\\COMMAND.COM]
> [key=CONTENT_LENGTH]=value[27593]
> [key=CONTENT_TYPE]=value[application/x-www-form-urlencoded]
> [key=DOCUMENT_ROOT]=value[c:/windows/desktop/web]
> [key=HTTP_CACHE_CONTROL]=value[no-cache]
> [key=HTTP_CONNECTION]=value[Keep-Alive]
> [key=HTTP_HOST]=value[localhost]
> [key=HTTP_USER_AGENT]=value[PostFavorites]
>
[key=PATH]=value[C:\\WINDOWS;C:\\WINDOWS\\COMMAND;C:\\PROGRA~1\\SSHCOM~1\\SS
>
HSEC~1;C:\\PROGRA~1\\MICROS~4\\80\\TOOLS\\BINN;C:\\PROGRA~1\\ULTRAE~1;C:\\PR
>
OGRA~1\\BORLAND\\DELPHI5\\BIN;C:\\PROGRA~1\\BORLAND\\VBROKER\\BIN;C:\\PROGRA
>
~1\\BORLAND\\VBROKER\\JRE\\BIN;C:\\PROGRA~1\\BORLAND\\DELPHI5\\PROJECTS\\BPL
> ;C:\\PROGRA~1\\ULTRAE~1]
> [key=REMOTE_ADDR]=value[127.0.0.1]
> [key=REMOTE_PORT]=value[1755]
> [key=SCRIPT_FILENAME]=value[c:/windows/desktop/web/test.php]
> [key=SERVER_ADDR]=value[127.0.0.1]
> [key=SERVER_ADMIN]=value[[EMAIL PROTECTED]]
> [key=SERVER_NAME]=value[211.22.80.5]
> [key=SERVER_PORT]=value[80]
> [key=SERVER_SIGNATURE]=value[<ADDRESS>Apache/1.3.24 Server at 211.22.80.5
> Port 80</ADDRESS>
> ]
> [key=SERVER_SOFTWARE]=value[Apache/1.3.24 (Win32) PHP/4.2.2]
> [key=WINDIR]=value[C:\\WINDOWS]
> [key=GATEWAY_INTERFACE]=value[CGI/1.1]
> [key=SERVER_PROTOCOL]=value[HTTP/1.1]
> [key=REQUEST_METHOD]=value[POST]
> [key=QUERY_STRING]=value[]
> [key=REQUEST_URI]=value[/test.php]
> [key=SCRIPT_NAME]=value[/test.php]
> [key=PATH_TRANSLATED]=value[c:/windows/desktop/web/test.php]
> [key=PHP_SELF]=value[/test.php]
> [key=argv]=value[Array]
> [key=argc]=value[0]
>
> so i know the content length is 27593........
>
> who can tell me how to get all data but not use $_POST variables.........
>
> thanks a lot......^^
>
>


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

Saturday, December 7, 2002, 6:36:18 AM, you wrote:
S> How would I run the functions though and then print the repeating decimal to
S> the screen?

The function returns the string ready to print
You will need to comment out the echo $s line, it was there for debugging.

just do <?php echo repeat($nuber to check)?>  where ever you need it



-- 
regards,
Tom

--- End Message ---
--- Begin Message ---
Ok, I'm getting some weird errors. Here's the website:

http://check.melchior.us/module.php?id=3

I attached the output file. What am I doing wrong!?


----- Original Message -----
From: "Tom Rogers" <[EMAIL PROTECTED]>
To: "Stephen" <[EMAIL PROTECTED]>
Cc: "PHP List" <[EMAIL PROTECTED]>
Sent: Friday, December 06, 2002 11:26 PM
Subject: Re[2]: [PHP] Repeating Decimals


> Hi,
>
> Saturday, December 7, 2002, 6:36:18 AM, you wrote:
> S> How would I run the functions though and then print the repeating
decimal to
> S> the screen?
>
> The function returns the string ready to print
> You will need to comment out the echo $s line, it was there for debugging.
>
> just do <?php echo repeat($nuber to check)?>  where ever you need it
>
>
>
> --
> regards,
> Tom
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--- End Message ---
--- Begin Message ---
Humour me. New server. I'm a little tired.
Where is my php.ini on a red hat server?
John

--- End Message ---
--- Begin Message ---
Hello,

"John Taylor-Johnston" <[EMAIL PROTECTED]> wrote:

> Humour me. New server. I'm a little tired.
> Where is my php.ini on a red hat server?

I took it :) Anyway,

Run phpinfo() --should give you a hint...

- E
--- End Message ---
--- Begin Message ---
if you ran locate php.ini you would find it's in /etc/php.ini :)
hey it sure beats RTFM, lol

On Fri, 06 Dec 2002 23:39:59 -0500
John Taylor-Johnston <[EMAIL PROTECTED]> wrote:

> Humour me. New server. I'm a little tired.
> Where is my php.ini on a red hat server?
> John
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
> 


-- 
Jerry M. Howell II
--- End Message ---
--- Begin Message ---
On 7 Dec 2002 at 0:43, Davy Obdam wrote:

> I ve just started with some OOP programming in PHP and now i have to
> build a set of classes that can generate a html form.. But i have a
> problem with the <select><option></option></select> thing.... I hope
> someone can help me here or give me some pointers,... any help is
> apreciated. Here is a part of my code :
> 
> class selectField extends formElement {
> 
>     //Constructor
>     function selectField($name, $value) {
>         formElement::setName($name);
>         formElement::setValue($value);
>     }
> 
>     function generateSelectField() {
>         $theOutput = "<select name=\"".$this->name."\">\n";
>         foreach($this->value as $key=>$val) {
>             $theOutput .= "<option 
> value=\"".$this->value."\">".$this->value."</option>\n";
>         }
>         $theOutput .= "</select>\n";
>         Return $theOutput;
>     }
> }
> 
> This is how i call the Object:
> 
> $test[] = "Test1";
> $test[] = "Test2";
> $test[] = "Test3";
> $test[] = "Test4";
> $test[] = "Test5";
> $select = new selectField("testje", $test);
> echo$select->generateSelectField();
> 
> But all i get is a select box with the word Array in it 5 times...Thanks
> for your time...

Below is an example that works. I don't know from formElement. But why, 
why in the world do you REALLY want to do this? Have you truly used and 
understood smarty and yet felt this must be done? I haven't. 

http://smarty.php.net/

It lets you focus on your application.

Peter


<?php

// require_once 'selectField.php';

$test[] = "Yea, this works";
$test[] = "No trouble mate";
$test[] = "Test3";
$test[] = "Test4";
$test[] = "Test5";

$select = new selectField("testje", $test);
echo $select->generateSelectField();


class selectField {

    var $name;
    var $value;
    
    function selectField($name, $value) {
        $this->name = $name;
        $this->value = $value;
    }

    function generateSelectField() {
        $theOutput = "<select name=\"".$this->name."\">\n";
        foreach($this->value as $key=>$val) {
            $theOutput .= "<option 
value=\"".$val."\">".$val."</option>\n";
        }
        $theOutput .= "</select>\n";
        return $theOutput;
    }
}


?>

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

Saturday, December 7, 2002, 9:43:47 AM, you wrote:
DO> Hi People,

DO> I ve just started with some OOP programming in PHP and now i have to 
DO> build a set of classes that can generate a html form.. But i have a 
DO> problem with the <select><option></option></select> thing....
DO> I hope someone can help me here or give me some pointers,... any help is 
DO> apreciated. Here is a part of my code :

DO> class selectField extends formElement {
   
DO>     //Constructor
DO>     function selectField($name, $value) {
DO>         formElement::setName($name);
DO>         formElement::setValue($value);
DO>     }

DO>     function generateSelectField() {
DO>         $theOutput = "<select name=\"".$this->name."\">\n";
DO>         foreach($this->value as $key=>$val) {
DO>             $theOutput .= "<option 
value=\"".$this->>value."\">".$this->value."</option>\n";
DO>         }
DO>         $theOutput .= "</select>\n";
DO>         Return $theOutput;
DO>     }
DO> }

DO> This is how i call the Object:

DO> $test[] = "Test1";
DO> $test[] = "Test2";
DO> $test[] = "Test3";
DO> $test[] = "Test4";
DO> $test[] = "Test5";
DO> $select = new selectField("testje", $test);
echo$select->>generateSelectField();

DO> But all i get is a select box with the word Array in it 5 times...Thanks 
DO> for your time...

DO> Best regards,

DO> Davy Obdam
DO> mailto:[EMAIL PROTECTED]

The output function is wrong it should be

function generateSelectField() {
        $theOutput = "<select name=\"".$this->name."\">\n";
        foreach($this->value as $key=>$val) {
            $theOutput .= "<option value=\"".$val."\">".$val."</option>\n"; //this line
        }
        $theOutput .= "</select>\n";
        Return $theOutput;
    }

-- 
regards,
Tom

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

Thanks it now works, ......

Best regards,

Davy Obdam
mailto:[EMAIL PROTECTED]

Tom Rogers wrote:

Hi,

Saturday, December 7, 2002, 9:43:47 AM, you wrote:
DO> Hi People,

DO> I ve just started with some OOP programming in PHP and now i have to DO> build a set of classes that can generate a html form.. But i have a DO> problem with the <select><option></option></select> thing....
DO> I hope someone can help me here or give me some pointers,... any help is DO> apreciated. Here is a part of my code :

DO> class selectField extends formElement {
DO> //Constructor
DO> function selectField($name, $value) {
DO> formElement::setName($name);
DO> formElement::setValue($value);
DO> }

DO> function generateSelectField() {
DO> $theOutput = "<select name=\"".$this->name."\">\n";
DO> foreach($this->value as $key=>$val) {
DO> $theOutput .= "<option value=\"".$this->>value."\">".$this->value."</option>\n";
DO> }
DO> $theOutput .= "</select>\n";
DO> Return $theOutput;
DO> }
DO> }

DO> This is how i call the Object:

DO> $test[] = "Test1";
DO> $test[] = "Test2";
DO> $test[] = "Test3";
DO> $test[] = "Test4";
DO> $test[] = "Test5";
DO> $select = new selectField("testje", $test);
echo$select->>generateSelectField();

DO> But all i get is a select box with the word Array in it 5 times...Thanks DO> for your time...

DO> Best regards,

DO> Davy Obdam
DO> mailto:[EMAIL PROTECTED]

The output function is wrong it should be

function generateSelectField() {
$theOutput = "<select name=\"".$this->name."\">\n";
foreach($this->value as $key=>$val) {
$theOutput .= "<option value=\"".$val."\">".$val."</option>\n"; //this line
}
$theOutput .= "</select>\n";
Return $theOutput;
}



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

Thanks for your help, but in this case i ve to build everythng up from the ground. Next time i`ll definatly take a look at smarty. It works now..

Best regards,

Davy Obdam
mailto:[EMAIL PROTECTED]

Peter J. Schoenster wrote:

On 7 Dec 2002 at 0:43, Davy Obdam wrote:


I ve just started with some OOP programming in PHP and now i have to
build a set of classes that can generate a html form.. But i have a
problem with the <select><option></option></select> thing.... I hope
someone can help me here or give me some pointers,... any help is
apreciated. Here is a part of my code :

class selectField extends formElement {

//Constructor
function selectField($name, $value) {
formElement::setName($name);
formElement::setValue($value);
}

function generateSelectField() {
$theOutput = "<select name=\"".$this->name."\">\n";
foreach($this->value as $key=>$val) {
$theOutput .= "<option value=\"".$this->value."\">".$this->value."</option>\n";
}
$theOutput .= "</select>\n";
Return $theOutput;
}
}

This is how i call the Object:

$test[] = "Test1";
$test[] = "Test2";
$test[] = "Test3";
$test[] = "Test4";
$test[] = "Test5";
$select = new selectField("testje", $test);
echo$select->generateSelectField();

But all i get is a select box with the word Array in it 5 times...Thanks
for your time...

Below is an example that works. I don't know from formElement. But why, why in the world do you REALLY want to do this? Have you truly used and understood smarty and yet felt this must be done? I haven't.
http://smarty.php.net/

It lets you focus on your application.

Peter


<?php

// require_once 'selectField.php';

$test[] = "Yea, this works";
$test[] = "No trouble mate";
$test[] = "Test3";
$test[] = "Test4";
$test[] = "Test5";

$select = new selectField("testje", $test);
echo $select->generateSelectField();


class selectField {

var $name;
var $value;
function selectField($name, $value) {
$this->name = $name;
$this->value = $value;
}

function generateSelectField() {
$theOutput = "<select name=\"".$this->name."\">\n";
foreach($this->value as $key=>$val) {
$theOutput .= "<option value=\"".$val."\">".$val."</option>\n";
}
$theOutput .= "</select>\n";
return $theOutput;
}
}


?>




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

Thursday, December 5, 2002, 9:40:20 PM, you wrote:
FW> Hi All,
FW> i have to migrate a website from WNT/IIS to Solaris/Apache.

FW> Some stuff seems to work, but now I am stuck with a page which gets cut 
FW> off in the middle of the out put. It is a template system with a chain 
FW> of includes and requires (4 files involved, no fancy stuff, just some 
FW> variable assignements and selection of templates based on the HTTP_HOST 
FW> header). The last file contains the HTML code for the browser, the 
FW> server starts to send the output to the client, but stops in the middle 
FW> of this file. The cut appears after a certain constant number of 
FW> characters (7728 characters, cr's not counted).

FW> CR/LFs are not an issue, I verified all invioved files, they are just 
FW> plain text, even in vi ;-)

FW> I have Apache/1.3.14 (Unix) PHP/4.0.6 tomcat/1.0 (tomcat is not used for 
FW> this pages)

FW> Has anybodey an idea whre to look for the cause?

FW> Thanks
FW>         Fritz

If the data is coming from an odbc connected database you may need to take a
look at odbc_longreadlen()

-- 
regards,
Tom

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

Saturday, December 7, 2002, 7:15:38 AM, you wrote:

>> ini_set
G> ("include_path","/path/to/local/includes:"ini_get("include_path"));
>>
>> Then no matter what directory you are in you can just include("filename");
>>
>> --
>> regards,
>> Tom
>>

G> Thank you. This should work, but I have one question about the format of
G> that. this way I can make sure I do things right (getting a parse error
G> right now)

G> what did you mean by "include_path"?
G> /path/to/local/includes is just the path to the default includes folder?
G> and is include_path just the path to the includes folder that I use. And
G> with this, do I use the URL, or the file path (what I get whenever I get
G> errors)

G> and thank you again
Looks like I forgot a '.' in there :)
"/path/to/local/includes:" is the path to your new includes, we do that first so
that is the first place it will look . The ':' is used to add in another path
which we use ini_get() to retrieve the system wide include file from php.ini.
You may drop this and the ':' if you don't need it.

so if you are setup like this for example

/home/username/public_html/...........web directory
/home/username/includes/..............your include directory

the line would be

ini_set("include_path","/home/username/includes:".ini_get("include_path"));

-- 
regards,
Tom

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

Saturday, December 7, 2002, 6:01:19 AM, you wrote:
CD> I'm not sure why this isn't working, been banging my head at it for a couple
CD> hours now.

CD> I have a file (index.php), which calls a function that draws the header to
CD> my page.

CD> Inside that function (site_header), is an include to a file (menu.php) which
CD> draws dynamic javascript menus based on
CD> cookie or session values.

CD> I can't seem to access ANY variables, be them $_SESSION, $_COOKIE, or
CD> anything else, inside this menu.php file.  I've tried even passing simple
CD> variables, globalizing them, etc, all the way down to see if I can access
CD> them in that menu.php file.  I still can't.. the closest I get is being able
CD> to access them in the site_header function, but when the include("menu.php")
CD> is called, everything seems to vanish.

CD> And yes, I have session_start(); at the top of my menu.php file as well..

CD> Can anyone help me out on this?  I was under the impression that the
CD> superglobals would be available from basically anything.. apparently I was
CD> wrong.

CD> Thanks,
CD> Chad

Get rid of that second session_start() you don't need it on included files only
on the main files which the browser is asking for.

-- 
regards,
Tom

--- End Message ---
--- Begin Message ---
Hello,

"Jeff Schwartz" <[EMAIL PROTECTED]> wrote:

>
> I have a large amount of data (1,948,280 bytes) that I tried to write out
to a file using
>
> if ($fp = fopen($file,"w")):
>
>             fwrite($fp,$contents,strlen($contents));
>
> fclose($fp);
>
> endif;

I'm not sure if I understand this correctly but don't you think you don't
need strlen($contents) up there? Also, try fopen($file,"wb").

And here,

> and got "Fatal error: Allowed memory size of 8388608 bytes exhausted
(tried to allocate 1948281 bytes)" on the 2nd line. So, I tried to write out
smaller portions with:
>
> if ($fp = fopen($file,"w")):
>
>             $size = 4096;
>
>             while (strlen($contents)){
>
>                         $temp = substr($contents,0,$size);
>
>                         fwrite($fp,$temp,$size);
>
>                         $contents = substr($contents,$size+1);
>
>             }
>
>             fclose($fp);
>
> endif;

...doing "$contents = substr($contents,$size+1);" would actually cause you
to lose some data.

Try this instead:

  if ($fp = fopen($file,"wb")): // add "b"
    $size = 4096;
     while (strlen($contents)){
       $temp = substr($contents,0,$size);
       fwrite($fp,$temp); // remove $size
       $contents = substr($contents,$size);  // remove "+1"
     }
     fclose($fp);
  endif;

I didn't test so I'm not sure if it'll work--just some ideas...

HTH,

- E

...[snip]...

--- End Message ---

Reply via email to