CodeIgniter Forums
captcha issue - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: captcha issue (/showthread.php?tid=47536)



captcha issue - El Forum - 12-12-2011

[eluser]Unknown[/eluser]
I'm trying to use the captcha helper and following the instructions provided by CI docs.
But even the default example provided by CI seems to fail. I've also created the captcha table from the sql provided in the example.

Code:
$this->load->helper('captcha');
   $vals = array(
       'img_path' => './captcha/',
       'img_url' => 'http://example.com/captcha/'
       );
  
   $cap = create_captcha($vals);
  
   $data = array(
       'captcha_time' => $cap['time'],
       'ip_address' => $this->input->ip_address(),
       'word' => $cap['word']
       );
  
   $query = $this->db->insert_string('captcha', $data);
   $this->db->query($query);

Produces:
Error Number: 1048

Column 'captcha_time' cannot be null

INSERT INTO `captcha` (`captcha_time`, `ip_address`, `word`) VALUES (NULL, '127.0.0.1', NULL)

Filename: D:\ci\system\database\DB_driver.php

Line Number: 330