php-general Digest 22 Mar 2006 23:47:37 -0000 Issue 4030

Topics (messages 232405 through 232424):

Reading data from SELECT in PHP
        232405 by: Lorca
        232406 by: Dan Parry
        232414 by: tedd

Re: PHP 4.3.11, question about classes
        232407 by: chris smith
        232408 by: Michael Hulse
        232410 by: chris smith

problem
        232409 by: Simone O'Brien
        232411 by: chris smith
        232413 by: Kevin Kinsey

Re: [SOLVED] PHP 4.3.11, question about classes
        232412 by: Michael Hulse

Re: Regarding your class: POP/IMAP to RSS
        232415 by: Vedanta Barooah

Re: Howto Execute PHP as script owner/group without CGI?
        232416 by: Rory Browne

Creating a Window without JavaScript that is on top
        232417 by: Todd Cary
        232418 by: Jay Blanchard
        232419 by: Jay Blanchard
        232422 by: tedd
        232423 by: Brady Mitchell

pulling in template file in var and populating vars?
        232420 by: blackwater dev
        232421 by: John Nichel

Error loading module php_mapscript.so (zend_hash_internal_pointer_reset_ex)
        232424 by: Fósforo

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:
        php-general@lists.php.net


----------------------------------------------------------------------
--- Begin Message ---
Hello friends,
I've create a form containing a SELECT under JavaScript, where the user 
decide all list's elements.

My problem is how can I get all list's elements on PHP. Using $-POST[] I 
only get the selected option.

With my most sincere thanks.

Lorca 

--- End Message ---
--- Begin Message ---
Maybe use Jacascript to create and populate hidden inputs?

They will show up in the $_POST array then

HTH

Dan

-----------------------------------------------------
Dan Parry
Senior Developer
Virtua Webtech Ltd
http://www.virtuawebtech.co.uk
-----Original Message-----
From: Lorca [mailto:[EMAIL PROTECTED] 
Sent: 22 March 2006 12:01
To: php-general@lists.php.net
Subject: [PHP] Reading data from SELECT in PHP

Hello friends,
I've create a form containing a SELECT under JavaScript, where the user 
decide all list's elements.

My problem is how can I get all list's elements on PHP. Using $-POST[] I 
only get the selected option.

With my most sincere thanks.

Lorca 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--- End Message ---
--- Begin Message ---
Hello friends,
I've create a form containing a SELECT under JavaScript, where the user
decide all list's elements.

My problem is how can I get all list's elements on PHP. Using $-POST[] I
only get the selected option.

With my most sincere thanks.

Lorca

Lorca:

Yes, a SELECT only returns one value.

You might want to look at:

http://www.weberdev.com/get_example-1739.html

It show one way to combine php and javascript variables.

tedd

PS: Probably a typo, but it's $_POST[]
--
--------------------------------------------------------------------------------
http://sperling.com

--- End Message ---
--- Begin Message ---
On 3/22/06, Michael Hulse <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I am just learning about classes.
>
> My server is running PHP 4.3.11
>
> Example code:
>
> class testing {
>         var $what;
> }
>
> $linkGenClass = new testing();
> $linkGenClass->what = 'hi';
> echo $linkGenClass->what;
>
> Why does the constructor require the "()"?

You're calling a method (which is a function inside a class). You
can't call a regular function without the brackets, so methods should
be the same.

> I have seen many examples via google that do not use "()".

It's better to use them mainly because it's the standard way (c#,
java, c++ all make you use them so better to get into the habit now).

> Should I worry about capitalizing the first letter of the class?

Personal preference. You don't need to.

> Can class names have underscores?

Yes.

> Are spaces allowed on either side of the "->"?

Try it and see what happens :)

> Is "var $what" PHP 4 and 5, whereas "public $what" is PHP 5?

Yes.

Public means you can do:

$linkGenClass->what = 'hi';

private means you can't access it that way.

> Got any good links to class tutorials for PHP 4.3.11?

Shameless plug for my own site :P
http://www.designmagick.com/article/18/PHP/Introduction-to-Object-Oriented-Programming

Other sites:
http://www.phpbuilder.com/columns/luis20000420.php3
http://www.onlamp.com/pub/a/php/2002/07/18/php_foundations.html

> Sorry to sound like a PHP noob.

We all started somewhere :)

--
Postgresql & php tutorials
http://www.designmagick.com/

--- End Message ---
--- Begin Message --- Hi Chris! Thanks for all the great answers, I really appreciate all of your help. I am browsing the link you gave me now.

I only have one question:

On Mar 22, 2006, at 4:09 AM, chris smith wrote:
You're calling a method (which is a function inside a class). You
can't call a regular function without the brackets, so methods should
be the same.

...

class testing {
        var $what;
}

$linkGenClass = new testing();
$linkGenClass->what = 'hi';
echo $linkGenClass->what;

Let me see if I have this straight: "class testing {}" is a method, and "$linkGenClass = new testing();" is the class...

I am pretty familiar with PHP functions... I was under the assumption that "class testing{}" was the class, and any functions inside that class were the methods?

An example function:

function example() {}

But, this would be considered a method?:

class method {}

Seems a bit confusing. Esp. when I construct the above method like so: "$myClass = new method();"

Hehe, I am sure that link you sent will give me some great answers, reading now.

I really appreciate your time/links/knowledge/help.   :)

Cheers,
Micky

--- End Message ---
--- Begin Message ---
On 3/22/06, Michael Hulse <[EMAIL PROTECTED]> wrote:
> Hi Chris! Thanks for all the great answers, I really appreciate all of
> your help. I am browsing the link you gave me now.
>
> I only have one question:
>
> On Mar 22, 2006, at 4:09 AM, chris smith wrote:
> > You're calling a method (which is a function inside a class). You
> > can't call a regular function without the brackets, so methods should
> > be the same.
>
> ...
>
> > class testing {
> >         var $what;
> > }
> >
> > $linkGenClass = new testing();
> > $linkGenClass->what = 'hi';
> > echo $linkGenClass->what;
>
> Let me see if I have this straight: "class testing {}" is a method, and
> "$linkGenClass = new testing();" is the class...

class testing {
}

is the class.

$linkGenClass = new testing();

creates an object.


functions inside the class:

class testing {
  function a() {
   echo 'inside method a';
  }
}

are methods.

> I am pretty familiar with PHP functions... I was under the assumption
> that "class testing{}" was the class, and any functions inside that
> class were the methods?

That's right.

Sorry for the confusion :)

--
Postgresql & php tutorials
http://www.designmagick.com/

--- End Message ---
--- Begin Message ---
Hi, I have set up a message board and we cannot log out or do anything on the 
page at all. We cannot use it at all.

http://myminiaturegoats.com/forum3/index.php?action=logout;sesc=331181faba9b2783a9506ad21068fb8b



      Database Error 
      Please try again. If you come back to this error screen, report the error 
to an administrator.  

This is what we get above on the screen.

Can you give me any idea on how we acess it and fix it?


Thankyou so much


Simone O'Brien

--- End Message ---
--- Begin Message ---
On 3/22/06, Simone O'Brien <[EMAIL PROTECTED]> wrote:
> Hi, I have set up a message board and we cannot log out or do anything on the 
> page at all. We cannot use it at all.
>
> http://myminiaturegoats.com/forum3/index.php?action=logout;sesc=331181faba9b2783a9506ad21068fb8b
>
>
>
>       Database Error
>       Please try again. If you come back to this error screen, report the 
> error to an administrator.
>
> This is what we get above on the screen.
>
> Can you give me any idea on how we acess it and fix it?

Ask the person who set it up which forum it is (phpbb for example). If
you can work out which forum it is, you'll be able to get help from
them.

If it's a custom forum, check the database logs and go from there.

Nobody's going to be able to help much with that sort of error, sorry.

--
Postgresql & php tutorials
http://www.designmagick.com/

--- End Message ---
--- Begin Message ---
Simone O'Brien wrote:

Hi, I have set up a message board and we cannot log out or do anything on the 
page at all. We cannot use it at all.

http://myminiaturegoats.com/forum3/index.php?action=logout;sesc=331181faba9b2783a9506ad21068fb8b



Database Error Please try again. If you come back to this error screen, report the error to an administrator.
This is what we get above on the screen.

Can you give me any idea on how we acess it and fix it?

Your forum is the "Simple Machines Forum"

               --- http://www.simplemachines.org/

The copyright indicates that this software is owned
by Lewis Media

               --- http://www.lewismedia.com/

The server that "runs" the 'myminiaturegoats.com' site
is apparently within a netblock owned by "securenet-server.net",
and the technical contact for this domain is listed as:

   Acenet Inc
   Jerald Darow        ([EMAIL PROTECTED])
   5880 N Canton Center Rd
   Canton
   MI,48187
   US
   Tel. +1.7343546936

Finally, there would be the "who" in the question "who
set up this site for you, or who hosts it, or what company
did you buy the web-space from?" (which looks like it should
be related to the above (Acenet), if not exactly them.

Any one of these sources should be a better place
to ask support questions than this mailing list.  This list
is for discussions of PHP programming (m/l), and your issue
is related to the actual use of software that just happens
to be written in PHP.  Not that we're particularly resentful,
but we can't give you much help.  You need to get in touch
with the person who's got access to the server.

The good news, however, is that it should be a relatively
simple issue to fix, provided you get in contact with the
right person; it's just that we ain't him/her.

G'day,

Kevin Kinsey

--
Oatmeal raisin.

--- End Message ---
--- Begin Message ---
On Mar 22, 2006, at 4:33 AM, chris smith wrote:
Sorry for the confusion :)

Not at all.  :)

I am stoked to be finally learning about OOP/classes/objects in PHP... the tutes you sent are very helpful.

Many thanks for you help, I really appreciate it.  ;)

Nice site btw, great info, cool design... thanks for sharing.  :D

Cheers,
Micky

--- End Message ---
--- Begin Message ---
hi Niek!
i was not actually handling multipart messages, good you pointed it out...
the class does something for multipart messages as off now... atleast it
trashes them off (check for the new version at the site)

http://www.phpclasses.org/browse/package/2977.html

well i am too lazy to decode multipart messages as off now, i might do it
when i have some time...

thanks,
vedanta



On 3/22/06, Niek van Baalen <[EMAIL PROTECTED]> wrote:
>
> Hi Vedanta,
>
> Good work. Just something I was waiting for.
> But I have the following problem.
> The body of a message did not show untill I  added addslashes.
>
> $this->xml.="<description>".addslashes($message)."</description>";
> or do I have to use another function.
>
> I receive all kinds of newsletters that can contain all kind of
> bodytext, like HTML etc.
>
> I still get XML-parserrors with content like
> <META NAME=GENERATOR CONTENT=\"Claris Home Page 3.0\">
> because of = character.
>
> Do you know a solution?
>
> Greetings,
> Niek van Baalen
> Amsterdam
>
>
-
*~:~*~:~*~:~*~:~*~:~*~:~*~:~*~:~*~:~*~:~*
Vedanta Barooah

--- End Message ---
--- Begin Message ---
suexec for the perl/cgi or anything_else/cgi for that matter.

suphp for PHP.

If speed is an issue, then you may like to consider suexec and fastcgi.

On 3/22/06, chris smith <[EMAIL PROTECTED]> wrote:
>
> On 3/22/06, Mathijs <[EMAIL PROTECTED]> wrote:
> > chris smith wrote:
> > > On 3/22/06, Mathijs <[EMAIL PROTECTED]> wrote:
> > >> chris smith wrote:
> > >>>> I Want to know if it is possible to execute PHP(5) as the
> owner/group of
> > >>>> the script it self.
> > >>>>
> > >>>> At the moment saved files get owner and group nobody.
> > >>>> When i upload through ftp, it gets the normal owner and group
> nobody.
> > >>>>
> > >>>> Is there a way that i can set both owner and group to
> > >>>> 'myuser-groupname', and let apache or php execute it with that
> owner/group?
> > >>> No. Only the 'root' user can change user/group.
> > >>>
> > >>> --
> > >>> Postgresql & php tutorials
> > >>> http://www.designmagick.com/
> > >> That i know,
> > >> But isn't there something like suexec or something for the apache
> module
> > >> of php5 to let it execute as another user?
> > >
> > > Some hosts let you compile your own cgi version to use instead of the
> > > main module and run everything through that instead of the apache
> > > module.. not sure if that's an option for you.
> > >
> > > What problem are you trying to solve exactly?
> > >
> >
> > for one, security.
> > Now group has write access else apache/php can't write to any file.
> > Group is nobody, and therefore everybody who has an virtual-host can
> > access the files as group.
> >
> > PHP Safe-mode is on, but this doesn't stop perl/cgi.
> >
> > I want it so that owner and group are both 500 for example.
> > Thisway i can set some files to public read only, and no one can access
> > the files anymore except the user him self :).
>
> I was going to suggest open_basedir restrictions might help but that
> won't stop perl/cgi scripts either..
>
> I think you're stuck :(
>
> --
> Postgresql & php tutorials
> http://www.designmagick.com/
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--- End Message ---
--- Begin Message --- Is there a way to create a Window that is like the Help or Popup type windows one can create with JavaScript?

I have an event calendar and I want the link for the event to go to a PHP page, but I want the page to be on top and have focus with a Close button. The PHP page will have some PHP code that will display the data passed by the GET var.

Todd

--- End Message ---
--- Begin Message ---
[snip]
Is there a way to create a Window that is like the Help or Popup 
type windows one can create with JavaScript?

I have an event calendar and I want the link for the event to go 
to a PHP page, but I want the page to be on top and have focus 
with a Close button.  The PHP page will have some PHP code that 
will display the data passed by the GET var.

[/snip]

Also, if you don't want to use javascript, you can use target="_blank"
in the link for the new window. You will not have any control over the
look of the window though;

<a href="foo.php" target="_blank">

And you can pass variables via the URL.

Remember, PHP is server-side. In order to things client-side you will
have to rely on client side tools such as javascript.

--- End Message ---
--- Begin Message ---
[snip]
Is there a way to create a Window that is like the Help or Popup 
type windows one can create with JavaScript?

I have an event calendar and I want the link for the event to go 
to a PHP page, but I want the page to be on top and have focus 
with a Close button.  The PHP page will have some PHP code that 
will display the data passed by the GET var.
[/snip]

You do know that JavaScript can open a PHP page right? Here is an
example....

/* 
* description:  pop up a window with a specific file 
* call:         <a href="javascript:popUp('<name of file to open like
foo.php>')"><link name></a>
*/
function popUp(url){
        pop = window.open(url,'window
name','width=300,height=200,toolbar=no,location=no,menubar=no,scrollbars
=no,resizable=no');
        pop.moveTo(50,50);
}

Whatever foo.php is will be displayed in the pop-up window. There are
several ways to pass variables back and forth using JavaScript....but
this is not the list for that :)

--- End Message ---
--- Begin Message ---
Jay said:

There are
several ways to pass variables back and forth using JavaScript....but
this is not the list for that :)

Can you point me to a list that does? I don't think there is a php <-> javascript list.

Personally, I think that posting a way to allow php to communicate with javascript OR any other language is relevant for a php-general list, don't you think?

tedd

--
--------------------------------------------------------------------------------
http://sperling.com

--- End Message ---
--- Begin Message ---
> Personally, I think that posting a way to allow php to communicate 
> with javascript OR any other language is relevant for a php-general 
> list, don't you think?

To use the value of a PHP variable in javascript, you create a
javascript variable and then echo the value of the php variable.  

For example:

Say you have a $price variable set in your PHP script and you want to
use that in a JavaScript.

<?php
        $price = 50;
?>

<script language="javascript" type="text/javascript">
        var price = <?php echo $price; ?>;
</script>

Assuming you put this in a .php file, PHP will parse the file and echo
the price before the javascript makes it to the browser, so if you look
at the source of the document you'll see:

<script language="javascript" type="text/javascript">
        var price = 50;
</script>

HTH,

Brady

--- End Message ---
--- Begin Message ---
I have a chunk of html data that I want to output for each iteration through
a db result

while($result){

   $list.=file_get_contents("my_template_file.php");

}
return $list;

The template file looks like this:

<table>
    <tr>
         <td><?php echo $result["name"];?></td>
    </tr>
</table>

I basically want a good way to keep the template file out of the class so I
don't have to code:
 $list.="<table><tr>...etc

The problem is with the method I have, it doesn't translate the
vars...what's the best way to do this?

Thanks!

--- End Message ---
--- Begin Message ---
blackwater dev wrote:
I have a chunk of html data that I want to output for each iteration through
a db result

while($result){

   $list.=file_get_contents("my_template_file.php");

}
return $list;

The template file looks like this:

<table>
    <tr>
         <td><?php echo $result["name"];?></td>
    </tr>
</table>

I basically want a good way to keep the template file out of the class so I
don't have to code:
 $list.="<table><tr>...etc

The problem is with the method I have, it doesn't translate the
vars...what's the best way to do this?

Thanks!


I wouldn't use a class/function to output anything. Why not just return the data, and loop thru that?

function myFunction() {
/* ----- Code ----- */
while ( $data = mysql_fetch_array ( $result, MYSQL_ASSOC ) ) {
        $return_data[] = $data;
}
}
return $return_data;



$myData = myFunction();
foreach ( $myData as $data ) {
        echo <<<END
<table>
        <tr>
                <td>$data["name"]</td>
        </tr>
</table>
END;
}

--
John C. Nichel IV
Programmer/System Admin (ÜberGeek)
Dot Com Holdings of Buffalo
716.856.9675
[EMAIL PROTECTED]

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

I just have compiled a module for my webserver, added it to
httpd.conf, but apache gives me an error when i try to start it:

[EMAIL PROTECTED]:/var/www/html/laget/servlet# apachectl configtest
Syntax error on line 241 of /etc/apache/httpd.conf:
Cannot load /usr/libexec/apache/php_mapscript.so into server:
/usr/libexec/apache/php_mapscript.so: undefined symbol:
zend_hash_internal_pointer_reset_ex

Ideas ?

Thanks a lot.

--- End Message ---

Reply via email to