Page 1 of 1

Parsing paramaters of an object back to itself

Posted: Mon Oct 23, 2006 6:41 am
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.

Re: Parsing paramaters of an object back to itself

Posted: Mon Oct 23, 2006 6:52 am
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.

Posted: Mon Oct 23, 2006 7:08 am
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?

Posted: Mon Oct 23, 2006 7:58 am
by volka
You may store some data as session data, see http://de2.php.net/session