On 4/19/06, Adele Botes <adele@xxxxxxxxx> wrote: > To anyone who can help, I would like to know why or how I can execute a > function within a function used within this class. I want to redirect if > the results of a insert query was successful, so i made a simple redirect > function for later use, once I've build onto the class. The problem is that > i am not sure why or how to get the redirect($url) to work within > insert_data($table,$values,$where) > > Even if I call the function: print redirect($url); and add the $url > argument > to insert_data it still doesn't work. I get undefined function error. What > am I doing wrong? > > <?php > require_once('../config.inc.php'); // contains define(WEB_ROOT, > 'http://www.example.com'); and $db_connection > > class DATA { > // variables > var $table; > var $fields; > var $where; > var $url; > > // Constructor must be the same name as the class > > // Functions > function insert_data($table,$values,$where) { > global $redirect; You don't use globals inside a class to reference other data inside the same class. Instead you need to do something like this: $add_location->url = 'blah'; then inside the class: if ($result) { # redirect here print $this->redirect($this->url); ... -- Postgresql & php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php