centenial Posted April 21, 2007 Share Posted April 21, 2007 Hey, I've been working on this (simple) MySQL class. It's gone well so far, but I can't seem to call a function from within a function inside the class. I want to be able to call the safeSQL function inside the executeQuery function, so that everytime I run a query it automatically checks to make sure the "SQL" is "safe". However, whenever I try to do that, I get this error: Fatal error: Call to undefined function safeSQL() on line 53 Can't you call a function from within a function in a PHP class? I appreciate your help. I'm kind of new to this whole OOP thing. Link to comment https://forums.phpfreaks.com/topic/48056-solved-call-function-from-within-a-function-oop/ Share on other sites More sharing options...
Glyde Posted April 21, 2007 Share Posted April 21, 2007 To call a function in a class, precede the function name with $this->. So, safeSQL() should become $this->safeSQL(). $this is a reference to the current class object. Link to comment https://forums.phpfreaks.com/topic/48056-solved-call-function-from-within-a-function-oop/#findComment-234861 Share on other sites More sharing options...
centenial Posted April 21, 2007 Author Share Posted April 21, 2007 Thanks! Link to comment https://forums.phpfreaks.com/topic/48056-solved-call-function-from-within-a-function-oop/#findComment-234862 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.