captcha multiple database question |
[eluser]joeizang[/eluser]
Hello folks, I am sorry to ask this cos I did some searching on the forum and see that similar problems exist but all solutions given have done nothing for me so far so let me give a quick pic of my setup. I already have a database for my local dev setup and I decided to setup captcha on a form and following the tutorials at okada.no created a database for captcha and then the multi-database setup need arose. I read the userguide and saw the instructions for setting up multiple databases for a single site and followed it and sadly it doesn't work! Here is my code in the config folder in database.php: Code: $active_group = "default"; And so (still following the okada tut on captcha) put the captcha maker and display code in the controller and then realized that I was not even getting to the dbcaptcha! So i did a test controller and model to try it with this code: Controller: Code: class TestCaptcha extends Controller And the model: Code: class TestCaptcha extends Model This still returns an error. This is the example of the error shown from this test. Code: A PHP Error was encountered ALL I ASK IS PLEASE HELP, FROM WHAT I SEE I DON'T HAVE A DATABASE RESOURCE TO WORK WITH. SO WHAT DO I DO? God bless.
[eluser]danmontgomery[/eluser]
First, you can't have two classes with identical names. Second, you've misspelled "construct" in both classes, and you never call the parent construct in either.
[eluser]joeizang[/eluser]
Noctrum, Thanks for taking time to read my post. I just forgot to put that in the test but even in the main application and i still get this error: Code: Fatal error: Call to a member function returnsome() on a non-object in D:\xampplite\htdocs\mannadev.local\appfiles\controllers\testcaptcha.php on line 15 If I understand this right, it means I don't have a database connection resource in the variable I am using to connect to the second active group for the second database. What do I do. Can CI's captcha work with sqlite? I'm not sure howto proceed from here. Thanks
[eluser]danmontgomery[/eluser]
[quote author="joeizang" date="1279074243"]If I understand this right, it means I don't have a database connection resource in the variable I am using to connect to the second active group for the second database. What do I do. Can CI's captcha work with sqlite? I'm not sure howto proceed from here.[/quote] You aren't understanding this right... The error message is that you're calling the method returnsome() on a non-object. As you can see in your controller, you are calling returnsome() on $this->testcaptcha. The testcaptcha model is never loaded, this is the root of the error message you're seeing now. Even if you do try to load it, it will fail because, as I mentioned, you can't have identically named classes. Code: private $securedb; Should be Code: private $securedb; You are also never calling the parent constructor in the controller, as I mentioned. I'd suggest you open the user guide and do some reading. http://ellislab.com/codeigniter/user-gui...llers.html http://ellislab.com/codeigniter/user-gui...odels.html
[eluser]joeizang[/eluser]
I did exactly what you put here... that is where I am getting the above error. I know it seems we green horns seem to be in a hurry but I have been going over this thing for a few hours and I don't understand why it's doing this. But I did apply the corrections you suggested and I am still getting the Code: atal error: Call to a member function returnsome() on a non-object in D:\xampplite\htdocs\mannadev.local\appfiles\controllers\testcaptcha.php on line 15 Code: class Testcap extends Model I am sorry for all the trouble. |
Welcome Guest, Not a member yet? Register Sign In |