Jump to content

mannyee

Members
  • Posts

    30
  • Joined

  • Last visited

    Never

Everything posted by mannyee

  1. your using the assignment operator '=' in your if condition, rather than making an equality comparison '==', you're assigning the values to the variables each time and each gets executed. change '=' to '=='
  2. well indeed... .but theres some advantage of using loop over extract().... you might already know it but anyways heres a link i found....: http://davidwalsh.name/convert-key-value-arrays-standard-variables-php besides lostnode wanted to know the other way too....i guess..!!
  3. well theres another way too.... you can try this: foreach($array_results as $key => $val){ $$key = $val; } so your column names (the associative index) will be variables that hold the values
  4. your form processing script is probably in your editprofile.php page. once you are done with the script and if everything goes as planned , you need to redirect to the page using the header() function,...like header('Location:profile.php'); Be sure to exit() the script after the header function
  5. well, you use the header function like header('Location: path/to/desired/page.php'); exit();
  6. many a thanks!!
  7. hi thorpe!! thanks very much for your ans..it did indeed work for me. in the mean time, your solution raised a new curiousity, will i be able to access this constructor's local variable $action from another method in the class, like: function Method(){ echo $action; } $obj = new Class(); $obj->Method(); // so that $action is printed i tried it and got a php notice: my idea is that since $action variable is part of the constructor, it must be included in the $obj unlike other private public and protected properties when we instantiate an object for the Class(). isn't it so?
  8. well...lets not store the action in the object property... i just want the action received from the query string to invoke the related method in the class.... if i got edit (or delete) action, i want it to be formatted into Edit() or Delete(), which i have done using ucwords($_GET['action']) . '()'; How can i invoke the relevant method? Currently, i've found out a solution just to please my boss... but i dont want to use if clause, i want to optimize it in such a way that when an action is received, we capitalize the first letter, concat () and invoke the relevant method....
  9. i have a constructor if action is present in the querystring, eg. delete, it would be stored into $this->action as Delete(). Similarly, if the action was edit, it would be stored as Edit(). My intent is to call the method named Delete() or Edit() depending upon which action was generated. I have defined the methods in the same class. Once i assign the current action to the $this->action, i want to call the method without explicitly specifying the method name.... here i have tried self::$this->action.... i even tried $this->action only but its not working? i think the string stored in the self::$this->action is not being interpolated? or....sth. i dont know. pls help out guys
  10. finally after a real depth speculation, i now understand this stuff...... nyways thanks to them who cared to read the post
  11. hi guys!! after spending few months on oop based programming, i'm trying to structure my code in mvc way... and i found this tutorial at http://www.phpro.org/tutorials/Model-View-Controller-MVC.html by kevin waterson. i can make almost all of it except the code on indexController.php this class has a private variable $registry. the author has assigned it an object that acts like a global variable. when i dump this variable as i get the following: and later on the author uses the following code to access a property $welcome in the template object. ....... as i understand template is just an array item in the vars[] array which is the private property of registry object (and this object is stored into the $this->registry property).... i don't understand the concept how the array item 'template' that stores the Template class object is used to access the Template class property welcome to set the value.... i mean if(is_object($this->registry->template)) echo 'yes'; prints yes. can someone shed the light on this?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.