CodeIgniter Forums

Full Version: Call a plugin in a library..
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]anggie[/eluser]
I am new to CodeIgniter...
I think I can call a plugin within my library. Am I right?
But I don't know why I cannot get a return data from it?
This is my function..
Code:
function setChaptcha()
    {
        $vals = array(
            'img_path'      => './asset/captcha/',
            'img_url'       => base_url().'/asset/captcha/',
            'expiration'    => 3600,// one hour
            'font_path'         => './system/fonts/georgia.ttf',
            'img_width'         => '150',
            'word'            => random_string('numeric', 6),
        );
        $cap = create_captcha($vals);
        $capdb = array(
                'captcha_id'      => '',
                'captcha_time'    => $cap['time'],
                'ip_address'      => $this->SA->input->ip_address(),
                'word'            => $cap['word']
        );
        $query = $this->SA->db->insert_string('captcha', $capdb);
        $this->SA->db->query($query);
        $data['cap'] = $cap;
        return $data;
    }
The error appear like this...
Code:
A Database Error Occurred

Error Number: 1048

Column 'captcha_time' cannot be null

INSERT INTO captcha (captcha_id, captcha_time, ip_address, word) VALUES ('', NULL, '192.168.10.207', NULL)
I did NOT modify the plugin before...
Could you give me some helps?
Thanks...

El Forum

[eluser]GSV Sleeper Service[/eluser]
silly question, but are you loading the plugin?
also, stick a print_r($cap) after your $cap = create_captcha($vals);

El Forum

[eluser]anggie[/eluser]
Yes..that is
I am not a high logic programmer.
and I am sure I load the plugin

El Forum

[eluser]GSV Sleeper Service[/eluser]
try this
Code:
function setChaptcha()
    {
        $vals = array(
            'img_path'      => './asset/captcha/',
            'img_url'       => base_url().'/asset/captcha/',
            'expiration'    => 3600,// one hour
            'font_path'         => './system/fonts/georgia.ttf',
            'img_width'         => '150',
            'word'            => random_string('numeric', 6),
        );
        $cap = create_captcha($vals);
        print_r($cap);
    }
you'll have some debug info on your screen, copy that and paste it back here.

El Forum

[eluser]anggie[/eluser]
There was nothing...just white screen

El Forum

[eluser]anggie[/eluser]
Sorry guys...
Silly...yes...silly...
I am just solve my problem...after browse the plugin, i find the clue.
I was wrong in entering the path!

El Forum

[eluser]anggie[/eluser]
Oh sorry again...
I forget to say Thanks! Especially for GSV Sleeper Service...