php-general Digest 14 Nov 2004 19:30:19 -0000 Issue 3112
Topics (messages 201961 through 201995):
Re: [PEAR] PEAR DB & PAGER & array_push
201961 by: Lorenzo Alberton
Silly OOP question
201962 by: Brent Clements
201963 by: Daniel Schierbeck
201969 by: -{ Rene Brehmer }-
201976 by: Robert Cummings
201979 by: Brent Clements
201980 by: Klaus Reimer
201989 by: -{ Rene Brehmer }-
201992 by: Robert Cummings
201994 by: Daniel Schierbeck
201995 by: Daniel Schierbeck
Re: php mail() error
201964 by: Manuel Lemos
201965 by: Manuel Lemos
Hacking attempt
201966 by: The Doctor
201967 by: raditha dissanayake
PHP+Oracle+Apache
201968 by: Evgeniy Sudyr
Database Search and seperate results page
201970 by: Stuart Felenstein
201986 by: Jason Wong
201987 by: Stuart Felenstein
PHPINIPATH/PHPINIDIR/PHPININAME?
201971 by: David Garamond
201973 by: Greg Donald
201978 by: David Garamond
201990 by: Jordi Canals
Re:[SOLVED] [PHP] Database Search and seperate results page
201972 by: Stuart Felenstein
Test post from a new client
201974 by: Robb Kerr
201993 by: Daniel Schierbeck
Overwriting offset methods of ArrayObject
201975 by: Klaus Reimer
File Handing Windows / Linux
201977 by: Steve Vernon
201983 by: Jason Wong
201984 by: M. Sokolewicz
PHP file permission
201981 by: Jerry Swanson
201982 by: M. Sokolewicz
201985 by: Jerry Swanson
alert function
201988 by: Mathieu Morin
201991 by: Larry E. Ullman
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 ---
[EMAIL PROTECTED] wrote:
Salut!
is there a good way to present data from table (many fields / not only one)
into $itemData instead of array_push (line 12 .. 16) ?
======================================
<?php
/**
* PEAR DB
*/
require_once 'DB.php';
$db = DB::connect("mysql://valerie:@localhost/valerie");
$query = 'SELECT id, name FROM country';
/**
* PEAR Pager Wrapper (this is the file stored
* in the /examples/ dir of the PEAR::Pager package).
* @see http://cvs.php.net/pear/Pager/examples/Pager_Wrapper.php
*/
require_once 'Pager/Wrapper.php';
$params = array(
'mode' => 'Jumping',
'perPage' => 30,
'delta' => 5,
);
$page = Pager_Wrapper_DB($db, $query, $params);
echo $page['links'];
?>
<table border="1">
<tr>
<th>ID</th>
<th>Country</th>
</tr>
<?php
foreach($page['data'] as $country) {
echo '<tr>';
echo '<td>'. $country['id'] .'</td>';
echo '<td>'. $country['name'] .'</td>';
echo '</tr>';
}
?>
</table>
======================================
HTH
Regards,
--
Lorenzo Alberton
http://pear.php.net/user/quipo
--- End Message ---
--- Begin Message ---
I've always wondered this about OOP and maybe you guys can answer this question.
I'm writing a php application and I'm trying to figure out the correct way to
right the oop part of this application.
for instance.
I have a "project.class" file that has functions for dealing with individual
projects because you break down ideas into singular entities in OOP(as I
understand it)
But what if I wanted to deal with multiple projects such as getting a list of
the projects in my database, should I create a function in the "project.class"
to handle the now plural request, or should I create a "projects.class" file
that has a function called "getProjects".
Hopefully I'm explaining this question right. It makes sense in my own head. :-)
Thanks,
Brent
--- End Message ---
--- Begin Message ---
Brent Clements wrote:
I've always wondered this about OOP and maybe you guys can answer this question.
I'm writing a php application and I'm trying to figure out the correct way to
right the oop part of this application.
for instance.
I have a "project.class" file that has functions for dealing with individual
projects because you break down ideas into singular entities in OOP(as I understand it)
But what if I wanted to deal with multiple projects such as getting a list of the projects in my database,
should I create a function in the "project.class" to handle the now plural request, or should I
create a "projects.class" file that has a function called "getProjects".
Hopefully I'm explaining this question right. It makes sense in my own head. :-)
Thanks,
Brent
Well, if I get you right, you have a class named Project holds
information about a project. Now you want a list of the current
projects. I'd make a new class, named ProjectList or something similar,
that can be used to administrate your projects.
class Project
{
public $name; // The project's name
public $ownerID; // The user ID of the project's owner
/* The constructor. Note: this only works in PHP5 */
public function __construct ($id)
{
$db = mysql_connect();
// Get project info...
$this->name = $result['name'];
$this->ownerID = $result['owner'];
}
}
class ProjectList
{
public $projects = array();
public function __construct ()
{
$db = mysql_connect();
$query = mysql_query('SELECT id FROM projects');
$result = mysql_fetch_array($query);
foreach ($result as $project_id) {
$this->projects[$project_id] = new Project($project_id);
}
}
public function listProjects ()
{
return $this->projects;
}
public function addProject ($name, $owner)
{
// ...
}
public function deleteProject ($id)
{
// ...
}
}
--
Daniel Schierbeck
Help spread Firefox (www.getfirefox.com):
http://www.spreadfirefox.com/?q=user/register&r=6584
--- End Message ---
--- Begin Message ---
At 12:34 14-11-2004, Brent Clements wrote:
I've always wondered this about OOP and maybe you guys can answer this
question.
I'm writing a php application and I'm trying to figure out the correct way
to right the oop part of this application.
for instance.
I have a "project.class" file that has functions for dealing with
individual projects because you break down ideas into singular entities in
OOP(as I understand it)
But what if I wanted to deal with multiple projects such as getting a list
of the projects in my database, should I create a function in the
"project.class" to handle the now plural request, or should I create a
"projects.class" file that has a function called "getProjects".
Hopefully I'm explaining this question right. It makes sense in my own
head. :-)
If I get what you're doing right, then you need to break it down more, if
you wanna go truly OOP ... and create an array of objects.
Something like:
$arrProjects[] = new project($projectname);
and then have an object for each idea, that are handled by the projects, like:
class Project {
var $project_name;
var $arrIdeas[];
function Project($projectname) {
$this->project_name = $projectname;
}
function add_idea() {
$this->arrIdeas[] = new idea();
}
}
Just remember that PHP isn't a true OOP language, so going OOP may not
necessarily be the best solution always. OOP makes certain types of
projects easier to code, and some projects would be almost impossible to do
without OOP (like anything you wanna do where you need to use scope to
avoid major headaches), but because PHP isn't compiled or a true OOP
language, OOP in PHP hampers performance, and that hampering is exponential
with the complexity of the objects.
FWIW
Rene
--- End Message ---
--- Begin Message ---
On Sun, 2004-11-14 at 09:30, -{ Rene Brehmer }- wrote:
> Just remember that PHP isn't a true OOP language, so going OOP may not
Please define "true OOP" language and provide a few examples that meet
your criteria. Then show how other examples like PHP fail to meet your
true OOP criteria. Don't forget, if a language has OOP as a subset, it
still has true OOP capabilities. Also it might help to clarify if you
mean PHP in general or PHP4 and below.
> necessarily be the best solution always. OOP makes certain types of
> projects easier to code, and some projects would be almost impossible to do
> without OOP (like anything you wanna do where you need to use scope to
> avoid major headaches), but because PHP isn't compiled or a true OOP
PHP is runtime compiled to bytecode. It's just as compiled as any other
language. With a good compiler cache it's just as compiled as java.
> language, OOP in PHP hampers performance, and that hampering is exponential
> with the complexity of the objects.
You're shitting us all right? Exponential? Really? could you show us
some benchmarks on how it's exponential?
Let's not be sowing seeds of FUD on the PHP general list.
Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'
--- End Message ---
--- Begin Message ---
Daniel,
Thanks for the insight, this is what I had thought. I just wanted to get a
peer's validation of my thought process.
You hit what I thought was right, right on the head.
-Brent
----- Original Message -----
From: "Daniel Schierbeck" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, November 14, 2004 6:54 AM
Subject: [PHP] Re: Silly OOP question
> Brent Clements wrote:
> > I've always wondered this about OOP and maybe you guys can answer this
question.
> >
> > I'm writing a php application and I'm trying to figure out the correct
way to right the oop part of this application.
> >
> > for instance.
> >
> > I have a "project.class" file that has functions for dealing with
individual projects because you break down ideas into singular entities in
OOP(as I understand it)
> >
> > But what if I wanted to deal with multiple projects such as getting a
list of the projects in my database, should I create a function in the
"project.class" to handle the now plural request, or should I create a
"projects.class" file that has a function called "getProjects".
> >
> > Hopefully I'm explaining this question right. It makes sense in my own
head. :-)
> >
> > Thanks,
> > Brent
> Well, if I get you right, you have a class named Project holds
> information about a project. Now you want a list of the current
> projects. I'd make a new class, named ProjectList or something similar,
> that can be used to administrate your projects.
>
>
> class Project
> {
> public $name; // The project's name
> public $ownerID; // The user ID of the project's owner
>
> /* The constructor. Note: this only works in PHP5 */
> public function __construct ($id)
> {
> $db = mysql_connect();
> // Get project info...
>
> $this->name = $result['name'];
> $this->ownerID = $result['owner'];
> }
> }
>
> class ProjectList
> {
> public $projects = array();
>
> public function __construct ()
> {
> $db = mysql_connect();
> $query = mysql_query('SELECT id FROM projects');
> $result = mysql_fetch_array($query);
>
> foreach ($result as $project_id) {
> $this->projects[$project_id] = new Project($project_id);
> }
> }
>
> public function listProjects ()
> {
> return $this->projects;
> }
>
> public function addProject ($name, $owner)
> {
> // ...
> }
>
> public function deleteProject ($id)
> {
> // ...
> }
> }
> --
> Daniel Schierbeck
>
> Help spread Firefox (www.getfirefox.com):
> http://www.spreadfirefox.com/?q=user/register&r=6584
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
--- End Message ---
--- Begin Message ---
Brent Clements wrote:
or should I
create a "projects.class" file that has a function called
"getProjects".
Yes, that's a possibility. You can even create more stuff in this
Projects class like createProject, removeProject and stuff like this. If
these tasks are pretty static and you don't need multiple instances of
the Projects class then you can implement it completely statically so
you don't need to instanciate the class:
class Projects
{
private static $projects = array();
public static function getAll()
{
return self::$projects;
}
public static function add(Project $project)
{
self::$projects[] = $project;
}
}
So now you can do this to get the projects:
$projects = Projects::getAll();
Adding objects to the list can be done by the constructor of the Project
class:
function __construct()
{
Projects::add($this);
}
--- End Message ---
--- Begin Message ---
At 17:14 14-11-2004, Robert Cummings wrote:
On Sun, 2004-11-14 at 09:30, -{ Rene Brehmer }- wrote:
> Just remember that PHP isn't a true OOP language, so going OOP may not
Please define "true OOP" language and provide a few examples that meet
your criteria. Then show how other examples like PHP fail to meet your
true OOP criteria. Don't forget, if a language has OOP as a subset, it
still has true OOP capabilities. Also it might help to clarify if you
mean PHP in general or PHP4 and below.
"True" as in parts of the OOP not being optional, like it is in PHP. You
can fudge around the OOP principle in PHP and still get it working.
> necessarily be the best solution always. OOP makes certain types of
> projects easier to code, and some projects would be almost impossible
to do
> without OOP (like anything you wanna do where you need to use scope to
> avoid major headaches), but because PHP isn't compiled or a true OOP
PHP is runtime compiled to bytecode. It's just as compiled as any other
language. With a good compiler cache it's just as compiled as java.
Compiled to byte-code is only the same as pre-compiled in most other
programming languages.
> language, OOP in PHP hampers performance, and that hampering is
exponential
> with the complexity of the objects.
You're shitting us all right? Exponential? Really? could you show us
some benchmarks on how it's exponential?
Dynamic object creation will always hamper performance relative to the
object complexity. It's true for all languages ... it's within seconds
though on a non-dedicated server, but depending on what you do, it's not
that hard to break 30 secs exec time on PHP that way.
Let's not be sowing seeds of FUD on the PHP general list.
Then it might be good to read instead of interpret.
--- End Message ---
--- Begin Message ---
On Sun, 2004-11-14 at 13:27, -{ Rene Brehmer }- wrote:
> At 17:14 14-11-2004, Robert Cummings wrote:
> >On Sun, 2004-11-14 at 09:30, -{ Rene Brehmer }- wrote:
> > > Just remember that PHP isn't a true OOP language, so going OOP may not
> >
> >Please define "true OOP" language and provide a few examples that meet
> >your criteria. Then show how other examples like PHP fail to meet your
> >true OOP criteria. Don't forget, if a language has OOP as a subset, it
> >still has true OOP capabilities. Also it might help to clarify if you
> >mean PHP in general or PHP4 and below.
>
> "True" as in parts of the OOP not being optional, like it is in PHP. You
> can fudge around the OOP principle in PHP and still get it working.
"True OOP" is a programming paradigm you can choose or not choose to
adhere to. Even in a purist OOP model, some person could implement their
entire application in a procedural manner by creating a single "Program"
object and using that object's methods as though they were non OOP
procedures. So thusly, if I choose to only use OOP features in my code,
then PHP is as pure as any other pure OOP model, by your own
understanding. Thus the ability of PHP to be OOP is entirely dependent
on the developer.
> > > necessarily be the best solution always. OOP makes certain types of
> > > projects easier to code, and some projects would be almost impossible
> > to do
> > > without OOP (like anything you wanna do where you need to use scope to
> > > avoid major headaches), but because PHP isn't compiled or a true OOP
> >
> >PHP is runtime compiled to bytecode. It's just as compiled as any other
> >language. With a good compiler cache it's just as compiled as java.
>
> Compiled to byte-code is only the same as pre-compiled in most other
> programming languages.
Semantics. Until any langiage compiles to pure 1s and 0s, it's all about
bytecode. Even C compiles to assembler which is really just a low level
bytecode.
> > > language, OOP in PHP hampers performance, and that hampering is
> > exponential
> > > with the complexity of the objects.
> >
> >You're shitting us all right? Exponential? Really? could you show us
> >some benchmarks on how it's exponential?
>
> Dynamic object creation will always hamper performance relative to the
> object complexity. It's true for all languages ... it's within seconds
> though on a non-dedicated server, but depending on what you do, it's not
> that hard to break 30 secs exec time on PHP that way.
There is a performance loss in any OOP system over a non OOP system,
because the great things like polymorphism have a pricetag. However,
your original comment specifically narrowed the field of attention to
PHP, which is not valid narrowing since it makes it seem like there are
OOP implementations that do not have performance overhead for such
features. If there are, I'm sure you can tell me a few.
>
> >Let's not be sowing seeds of FUD on the PHP general list.
>
> Then it might be good to read instead of interpret.
To read is to interpret. Otherwise you're just looking. You moment you
give anything meaning you have made an interpretation. Albeit the
interpretation may be based on globally shared rules, or personal
subjective ideals. Either way, your writing was not IMHO based on
globally shared rules, but rather on your own personal subjective
ideals, which again IMHO, were promoting FUD for PHP OOP.
Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'
--- End Message ---
--- Begin Message ---
Brent Clements wrote:
I've always wondered this about OOP and maybe you guys can answer this question.
I'm writing a php application and I'm trying to figure out the correct way to
right the oop part of this application.
for instance.
I have a "project.class" file that has functions for dealing with individual
projects because you break down ideas into singular entities in OOP(as I understand it)
But what if I wanted to deal with multiple projects such as getting a list of the projects in my database,
should I create a function in the "project.class" to handle the now plural request, or should I
create a "projects.class" file that has a function called "getProjects".
Hopefully I'm explaining this question right. It makes sense in my own head. :-)
Thanks,
Brent
Who cares whether or not PHP is an object oriented language? If it has
OO features, you can call it whatever you like, I'd still be happy.
--
Daniel Schierbeck
Help spread Firefox (www.getfirefox.com):
http://www.spreadfirefox.com/?q=user/register&r=6584
--- End Message ---
--- Begin Message ---
Klaus Reimer wrote:
you can implement it completely statically so
you don't need to instanciate the class
Well, it might be useful to have more than one list of projects, ie if
you want all design-related projects, or all PHP-projects.
--
Daniel Schierbeck
Help spread Firefox (www.getfirefox.com):
http://www.spreadfirefox.com/?q=user/register&r=6584
--- End Message ---
--- Begin Message ---
Hello,
On 11/14/2004 03:49 AM, Curt Zirzow wrote:
Requiring authentication is one common solution to not leave
relaying opened.
Common but not the *only* way.
That is irrelevant because most servers that issue the message above
only allow relaying with prior authentication.
FYI, the class that I suggested implements both SMTP and POP3 based
authentication.
Maybe if you try them you will realize that I am provide a plain simple
solution for the problem of the original poster because it consists only
in replacing the mail() calls to the smtp_mail() provided with these
classes:
you know we're going down the same road that took up to much of my
time from the last time. You simply dont comprehend that your
solution is *not* the only solution and take offence to that.
No, I take offence when you label as spam the messages that I post
suggesting solutions that solve the original poster problem.
We are just on the same road from the last time because you are still
being childish and acting imaturely trying to insult me on a public forum.
You are only making a fool of yourself because you reveal that a) you
are not providing any solution (sending people to go and figure what
their problem is on Google is not a solution), b) you are
underestimating my knowledge of many years about this subject.
Sometimes I forget names. But then when I notice the pattern of labeling
as spam my messages helping others in PHP mailing lists, some bells ring.
This is the very first time i ever labeled your stuff as spam.
It is not the first time you try to offend me and obstruct my attempts
to help PHP users, that is the pattern.
There aren't many people that get keep protesting against my messages of
helping others with ready to use PHP components that I have developed
for many years to solve problems like they present.
I have no problem with your solutions, I've simply stated that it
may not be the only solution.
Basically you have no clue what the problem is. That is why your reply
was to go and figure in Google. If you had a clue, you would realize
that a) this is a frequently posed problem, b) the solution is that it
requires authentication because that is the default configuration for
Microsoft SMTP servers. You can suggest other solutions (which you
didn't) but those require changing the SMTP server configuration, which
is usually beyhond the users possibilities.
--
Regards,
Manuel Lemos
PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/
Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html
--- End Message ---
--- Begin Message ---
Hello,
On 11/14/2004 04:11 AM, Curt Zirzow wrote:
Im using the php mail() function to try send an email to a user that has
just registered.
mail($HTTP_POST_VARS['emailaddress1'], 'Matchmakers Website
Registration' ,
'Welcome');
But when I get the following error back.:
Warning: mail(): SMTP server response: 550 5.7.1 Unable to relay for
[EMAIL PROTECTED]
Can someone help me out, by telling me what it means or what Im doing
wrong?
(Thank you Jason for the introduction! :-)
That means your SMTP server requires authentication to relay messages.
The mail function does not support SMTP authentication.
for the record.. and to not mislead several people.. 550 simply
means the message was not accepted. There are several other reasons
why this will happen. The text after the 550 usually signifies what
exactly the problem is.
Yes, but 550 with the text in front of "5.7.1 Unable to relay for
[EMAIL PROTECTED]" is a common message presented by servers that only
relay with prior authentication. If you had enough real world experience
with SMTP servers you would know that.
Again.. a simple google search reveals the other issues that may be
involved. Your tool's *may* solve the problem, but it isn't 100%
http://support.microsoft.com/default.aspx?scid=kb;en-us;q289553
<quote>
While there are several causes for this error, the most common one
is that there may be no recipient policy for the expected domain in
the Exchange 2000 organization or the Exchange 2003 organization.
</quote>
http://support.microsoft.com/?kbid=304897
http://www.eudora.com/techsupport/kb/1593hq.html
Man, try to learn this for once. It is standard for Microsoft SMTP
servers to be configured by default to not allow relaying messages to
foreign domains without requiring prior SMTP authentication. Although,
it is possible that the problem may be slightly different, that is not
the default, so it is unlikely that just performing SMTP authentication
would not solve the problem.
Trust the voice of experience, it has been this way for years. Many
people have already posted the same problem in this list since a long
time ago and I have never heard of anybody that posted this same problem
and used my classes with SMTP authentication without success.
I developed the smtp_mail() function wrapping these classes precisely to
make the solution straightforward for the users that just have to make a
minimal change from the mail() calls to smtp_mail(). I do not use
Microsoft software. I developed this because I had many requests from
Microsoft users.
Try it yourself on standard Microsoft SMTP server installation and
you'll see.
http://www.phpclasses.org/mimemessage
http://www.phpclasses.org/smtpclass
http://www.phpclasses.org/sasl
--
Regards,
Manuel Lemos
PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/
Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html
--- End Message ---
--- Begin Message ---
One of our customers how has
Hacking attempt on their index.php instead of their regualr page.
What caused this and how do we get the regualr page back?
--
Member - Liberal International
This is [EMAIL PROTECTED] Ici [EMAIL PROTECTED]
God Queen and country! Beware Anti-Christ rising!
Alberta on 22 Nov 2004 Boot out Ralph Klein - Vote Liberal!!
--- End Message ---
--- Begin Message ---
and what exactly is a hacking attempt?
The Doctor wrote:
One of our customers how has
Hacking attempt on their index.php instead of their regualr page.
What caused this and how do we get the regualr page back?
--
Raditha Dissanayake.
------------------------------------------------------------------
http://www.radinks.com/print/card-designer/ | Card Designer Applet
http://www.radinks.com/upload/ | Drag and Drop Upload
--- End Message ---
--- Begin Message ---
Good day,
I use Apache2+PHP5+Oracle8 under WindowsXP & I want use php with
Oracle. I uncommented strings in php.ini:
;extension=php_oci8.dll
;extension=php_oracle.dll
;extension=php_dbase.dll
Now when I start apache it say me that this extensions are not present
in extensions dir (But they are exactly here!)
Can anybody help me?
-------------------
Best regards,
Evgeniy Sudyr
--- End Message ---
--- Begin Message ---
After googling for quite some time I'm back asking
here. I want to be able to seperate by search and
results into two pages.
My form is set up on Search.php
I have set action"searchresults.php"
Couple of questions:
I have my array of user selected options from my form
element - Ind[]
I gather the processing of the array needs to be done
first before posting.
I tried this:
searchresults.php?Ind=<?php
echo((isset($_POST["Ind[]"]))?$_POST["Ind[]"]:"") ?>
but all I saw in the searchresults.php url was ..?ind
=
?
Does the searchresults page need to use the GET method
to gather up the variables?
Thanks
Stuart
--- End Message ---
--- Begin Message ---
On Sunday 14 November 2004 22:31, Stuart Felenstein wrote:
> After googling for quite some time I'm back asking
> here. I want to be able to seperate by search and
> results into two pages.
Sadly, you're really not learning much from this list ...
> My form is set up on Search.php
> I have set action"searchresults.php"
>
> Couple of questions:
> I have my array of user selected options from my form
> element - Ind[]
>
> I gather the processing of the array needs to be done
> first before posting.
> I tried this:
> searchresults.php?Ind=<?php
> echo((isset($_POST["Ind[]"]))?$_POST["Ind[]"]:"") ?>
> but all I saw in the searchresults.php url was ..?ind
> =
> ?
... print_r()/var_dump() $_POST["Ind[]"], what do you see? Nothing I bet. Why?
See manual > PHP and HTML for details.
Basically the contents of your form elements named 'Ind[]' have been placed in
an array named 'Ind' and lives inside $_POST, ie $_POST['Ind'], and you can
print_r() to see what it contains.
> Does the searchresults page need to use the GET method
> to gather up the variables?
Yes, if you're using this method to pass them on:
searchresults.php?Ind...
Unfortunately, you can't just stick $_POST['Ind'] in there:
searchresults.php?Ind[]=$_POST['Ind']
There are 2 way you can do this:
a) Pass the individual elements of $_POST['Ind']
or
b) serialize() $_POST['Ind'], pass it as a single element, then on the
receiving page unserialize() it
Conceptually (a) will probably be easier to understand so:
you need to build a string which looks like:
Ind[1]=value1&Ind[2]=value2...&Ind[n]=valuen
which you append to your URL like so:
searchresults.php?Ind[1]=value1&Ind[2]=value2...&Ind[n]=valuen
This can be done using a foreach() on $_POST['Ind'], and implode(). Remember
to validate each item as you go along.
And PLEASE, stick:
error_reporting(E_ALL);
ini_set('display_errors', TRUE);
on top of all your pages whilst you're developing.
--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
Aw, screw it. It probably isn't all that good anyway.
Cartman, what are you talking about? You love Terrance and Philip!
Yeah, but the animation is crappy.
*/
--- End Message ---
--- Begin Message ---
--- Jason Wong <[EMAIL PROTECTED]> wrote:
> Sadly, you're really not learning much from this
> list ...
I partially disagree. I think it might be better for
me to take a more elementary approach to the language
before getting moving on to specific project issues.
> ... print_r()/var_dump() $_POST["Ind[]"], what do
> you see? Nothing I bet. Why?
> See manual > PHP and HTML for details.
>
>
> There are 2 way you can do this:
>
> a) Pass the individual elements of $_POST['Ind']
>
> or
>
> b) serialize() $_POST['Ind'], pass it as a single
> element, then on the
> receiving page unserialize() it
>
I posted a few hours prior to your response that this
was solved. I am using the $_POST method. On the
results page I check to see if there are any elements
set and then move on to implode.
It's working. Though I have some other things to
figure out ;)
Stuart
--- End Message ---
--- Begin Message ---
I wonder why the CLI version of PHP doesn't consult environment
variables to override some default settings. This mechanism is used by
all the other interpreters that I use (e.g.: perl with PERLLIB/etc,
python with PYTHONHOME/PYTHONPATH/etc, ruby with
RUBYOPT/RUBYLIB/RUBYPATH/etc).
PS: I am aware of -c. It would be nice to have something like
PHP_INI_PATH/PHP_INI_DIR/PHP_INI_NAME though...
Regards,
dave
--- End Message ---
--- Begin Message ---
On Sun, 14 Nov 2004 21:53:52 +0700, David Garamond
<[EMAIL PROTECTED]> wrote:
> I wonder why the CLI version of PHP doesn't consult environment
> variables to override some default settings. This mechanism is used by
> all the other interpreters that I use (e.g.: perl with PERLLIB/etc,
> python with PYTHONHOME/PYTHONPATH/etc, ruby with
> RUBYOPT/RUBYLIB/RUBYPATH/etc).
>
> PS: I am aware of -c. It would be nice to have something like
> PHP_INI_PATH/PHP_INI_DIR/PHP_INI_NAME though...
print_r($_ENV);
--
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/
--- End Message ---
--- Begin Message ---
Greg Donald wrote:
On Sun, 14 Nov 2004 21:53:52 +0700, David Garamond
<[EMAIL PROTECTED]> wrote:
I wonder why the CLI version of PHP doesn't consult environment
variables to override some default settings. This mechanism is used by
all the other interpreters that I use (e.g.: perl with PERLLIB/etc,
python with PYTHONHOME/PYTHONPATH/etc, ruby with
RUBYOPT/RUBYLIB/RUBYPATH/etc).
PS: I am aware of -c. It would be nice to have something like
PHP_INI_PATH/PHP_INI_DIR/PHP_INI_NAME though...
print_r($_ENV);
What should I see in it?
--
dave
--- End Message ---
--- Begin Message ---
On Sun, 14 Nov 2004 23:42:58 +0700, David Garamond
<[EMAIL PROTECTED]> wrote:
> Greg Donald wrote:
>
>
> > print_r($_ENV);
>
> What should I see in it?
>
RTFM
http://www.php.net/manual/en/reserved.variables.php#reserved.variables.environment
--- End Message ---
--- Begin Message ---
--- Stuart Felenstein <[EMAIL PROTECTED]> wrote:
--- End Message ---
--- Begin Message ---
This is a test post from a new client. I'm trying to decide whether or
not to keep it. Please post a reply so that I can see how it shows up.
Thanx,
Robb
--- End Message ---
--- Begin Message ---
Robb Kerr wrote:
This is a test post from a new client. I'm trying to decide whether or
not to keep it. Please post a reply so that I can see how it shows up.
Thanx,
Robb
FUBAR
--
Daniel Schierbeck
Help spread Firefox (www.getfirefox.com):
http://www.spreadfirefox.com/?q=user/register&r=6584
--- End Message ---
--- Begin Message ---
Hello,
I just tried to overwrite a method of ArrayObject like this:
class MyArrayObject extends ArrayObject
{
public function offsetGet($key)
{
echo "Here I am\n";
return parent::offsetGet($key);
}
}
$o = new MyArrayObject();
$o['test'] = 'test';
echo $o['test'];
I think this should output the text "Here I am" because I have
overwritten the offsetGet method of ArrayObject which is called if I
access an array element of this object. But it doesn't. My method is
simply ignored.
Then I've written a simple Object which implements the ArrayAccess
interface like the ArrayObject object does. And then I have done the
same as above but this time I don't extend ArrayObject but my own
object. This works. My overwrite method is called
I'm confused. Why can't I overwrite the method in ArrayObject? Is this a
bug? Or are the methods of ArrayObject marked as "final"? But even then
I must get an "Cannot override final method" error.
Some hints if I misunderstood something? If not I'm going to file a bug
report.
--- End Message ---
--- Begin Message ---
Hiya!
I am trying to make some code which gets a handle to a directory, but has
different code for my localhost (Windows) and for online (Linux server).
Basically, I want either of the below lines. Say if the first fails, it must
be on Linux and then it uses the line below.
The two example lines are:
@ $handle =
opendir("c:/websites/mywebsite/extra/photos/".$_GET['page']."/");
@ $handle =
opendir("/home/mywebsite/public_html/extra/photos/".$_GET['page']."/");
Had a search on google, but not really sure what to look for!
Love,
Steve
XxX
--- End Message ---
--- Begin Message ---
On Monday 15 November 2004 00:34, Steve Vernon wrote:
> I am trying to make some code which gets a handle to a directory, but has
> different code for my localhost (Windows) and for online (Linux server).
>
> Basically, I want either of the below lines. Say if the first fails, it
> must be on Linux and then it uses the line below.
>
> The two example lines are:
>
> @ $handle =
> opendir("c:/websites/mywebsite/extra/photos/".$_GET['page']."/");
opendir() returns FALSE if directory cannot be opened for any reason. You can
also use file_exists(), is_dir().
--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
Hodie natus est radici frater.
[ Unto the root is born a brother ]
*/
--- End Message ---
--- Begin Message ---
Steve Vernon wrote:
Hiya!
I am trying to make some code which gets a handle to a directory, but has
different code for my localhost (Windows) and for online (Linux server).
Basically, I want either of the below lines. Say if the first fails, it must
be on Linux and then it uses the line below.
The two example lines are:
@ $handle =
opendir("c:/websites/mywebsite/extra/photos/".$_GET['page']."/");
@ $handle =
opendir("/home/mywebsite/public_html/extra/photos/".$_GET['page']."/");
Had a search on google, but not really sure what to look for!
Love,
Steve
XxX
if(false === ($handle =
opendir("c:/websites/mywebsite/extra/photos/".$_GET['page']."/"))) {
$handle =
opendir("/home/mywebsite/public_html/extra/photos/".$_GET['page']."/");
}
--- End Message ---
--- Begin Message ---
What is the optimal PHP file permission?
--- End Message ---
--- Begin Message ---
depends on what you need it for
Jerry Swanson wrote:
What is the optimal PHP file permission?
--- End Message ---
--- Begin Message ---
regular php page, some mysql queries and print html on the screen.
On Sun, 14 Nov 2004 18:19:28 +0100, M. Sokolewicz <[EMAIL PROTECTED]> wrote:
> depends on what you need it for
>
>
>
> Jerry Swanson wrote:
>
> > What is the optimal PHP file permission?
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--- End Message ---
--- Begin Message ---
In html, there is the alert() function that makes a popup with a ok button.
Is there such a thing in php?
example:
if ($lastname == "") {
print "<br><br><center><font face=arial color=red>Enter a
name!</font></center>";
}
but that changes my page setup.
--- End Message ---
--- Begin Message ---
In html, there is the alert() function that makes a popup with a ok
button.
Is there such a thing in php?
Actually, that's a JavaScript function. You can't do the same thing in
PHP although you can use PHP to create the JavaScript. Printing an
error message, like you already had, is probably a better choice,
though (IMHO).
Larry
--- End Message ---