Parsing paramaters of an object back to itself

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mcccy005
Forum Contributor
Posts: 123
Joined: Sun May 28, 2006 7:08 pm

Parsing paramaters of an object back to itself

Post by mcccy005 »

Ok so I've created a results.php object which accepts the following paramaters:
1. an array of Titles for each column of the results
2. an array of column names of each column of the database
3. an sql query
4. a database connection.

When I try to click "NEXT" to see the results on the next page, I some errors including these:
Notice: Undefined index: 2 in D:\XXXXX\Web_Pages\Object_Library\Result_Fields\results.php on line 103
Notice: Trying to get property of non-object in D:\XXXXX\Web_Pages\Object_Library\Result_Fields\results.php on line 122

Basically, its looking for the above paramaters which (obviously) arent there when I re-call the current web page whilst modifying the paramaters in the $_GET array.

Yes, I realise I could just create each of the above paramaters and set them in stone in the results.php file, but that would mean for each set of results I display which take a different query, I would have all that code duplicated....sounds like bad programming in my book!

Is there a way, I can re-call the current PHP file using the same objects/paramaters parsed to the current file; whilst modifying the paramaters in the url (ie. in the $_GET array)???

Thanks.
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Re: Parsing paramaters of an object back to itself

Post by volka »

mcccy005 wrote:When I try to click "NEXT" to see the results on the next page
This means a "next" link in a browser, i.e. a new http request? If so then it is handled by a new instance of your script, an object of a previous instance is gone. When this single request is done all objects, resources etc will be destroyed and another request will be handled again by new instance of the script.
mcccy005
Forum Contributor
Posts: 123
Joined: Sun May 28, 2006 7:08 pm

Post by mcccy005 »

Yeah it is a http request.
Is there some other way I can simply re-call the current file and change the paramaters in the url whilst still maintaining the current objects/resources etc that I initially parsed to the class?
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

You may store some data as session data, see http://de2.php.net/session
Post Reply