• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Database problem

#1
Hi guys/gals.

I recently downloaded some software made with the codeigniter framework after following the install instructions, I ran the website on localhost, which loads up but as soon as I goto register as a new member it gives me the following error.

Error Number: 1054
Unknown column 'activation_hash' in 'field list'
INSERT INTO `bw_users` (`password`, `location`, `register_time`, `salt`, `activation_hash`, `activation_id`, `email_address`, `email_activated`, `user_hash`, `user_name`, `user_role`, `public_key`, `private_key`, `private_key_salt`, `wallet_salt`, `local_currency`) VALUES $2a$10$51GaLf4o644Rb/FxR8Os9enxWuop1V.haISOHzinT1Tq674.5SaXm', '224', 1454533259, '$2a$10$51GaLf4o644Rb/FxR8Os9hA2gGDxVQ==', 'f0a57fb24bcda7bd87e26bc9bafb71ee', 'ae7522de65812b', '', '1', '2eb1a2c0b086bf044a80',

Filename: models/Users_model.php

Line Number: 37

I pulled up the Users_model line 37 and the code surrounding it

public function add($data, $token_info = NULL)
    {
        $ret = $this->db->insert('users', $data) == TRUE;   <<<<<<<<  This is line 37
        if ($token_info !== null)
            $this->delete_registration_token($token_info['id']);

        return $ret;
    }


Does anyone know what this issue might be? I'm new to Ci so i don't have codeigniter itself downloaded just the package which came with this software that i'm using if that makes any diffrence feel free to inform me.

Thanks
Reply

#2
The error message you received, "Unknown column 'activation_hash' in 'field list'", provides a clue!
Your local database is missing that column in the bw_users table, and the downloaded software expects it.
This could be a mismatch between versions of the your software, or incomplete setup instructions.

This is not a CodeIgniter issue.
Reply

#3
Thank you for the information.
Reply

#4
I just had a look though the files and the only place anywhere including the sql database that it mentions activation_hash is in this little snippet. Do you think this could be the cause and if it is what would you suggest to remedy it ? I'm really new to all this if you can't tell so I apologize for these questions but i'm stumped.

/**
* Set Activated Email
*
* This function takes a $user_id and marks that account as having its email activated.
*
* @param $user_id
*/
protected function _set_activated_email($user_id)
{
$this->db->where('id', $user_id)->update('users', array('email_activated' => '1'));
}

/**
* Attempt Email Activation
*
* This function is used to try activate a users account for the first time. If successful,
* it will set the email as activated, and the function returns TRUE. If the details were invalid,
* FALSE is returned. If the email was already updated, then return 'activated'
*
* @param $identifier
* @param $subject
* @param $activation_hash
* @return bool|string
*/
public function attempt_email_activation($identifier, $subject, $activation_hash)
{
$q = $this->db->select('id, email_activated')->get_where('users', array($identifier => $subject, 'activation_hash' => $activation_hash));
if ($q->num_rows() > 0) {
$row = $q->row_array();
if ($row['email_activated'] == '1') {
return 'activated';
} else {
$this->_set_activated_email($row['id']);
return TRUE;
}
}
return FALSE;
}
}
Reply

#5
you table has not field activation_hash
Reply

#6
First let me apologize for posting again here but I've been working on this for over 8 hours and I just wanted to be finished, I deleted the whole database and reinstalled it from the sql dump provided with the source code.

I noticed an error this time in the console saying syntax error around line 1116, now I'm either blind or I'm just missing it but I can't see any problem, can anyone see whats going on here ?

CREATE TABLE IF NOT EXISTS `bw_users` (
`id` int(9) NOT NULL AUTO_INCREMENT,
`banned` enum('0','1') DEFAULT '0',
`block_non_pgp` enum('0','1') DEFAULT '0',
`entry_paid` enum('0','1') DEFAULT '0',
`force_pgp_messages` enum('0','1') DEFAULT '0',
`location` int(3) NOT NULL,
`login_time` int(20) NOT NULL,
`display_login_time` enum('0','1') DEFAULT '0',
`password` varchar(128) NOT NULL,
`public_key` blob NOT NULL,
`private_key` blob NOT NULL,
`private_key_salt` varchar(64) NOT NULL,
`register_time` int(20) NOT NULL,
`salt` varchar(128) NOT NULL,
`wallet_salt` varchar(128) NOT NULL,
`user_hash` varchar(25) NOT NULL,
`user_name` varchar(40) NOT NULL,
`user_role` enum('Buyer','Vendor','Admin') NOT NULL,
`local_currency` int(11) NOT NULL,
`completed_order_count` int(9) DEFAULT '0',
`totp_secret` varchar(25),
`totp_two_factor` enum('0','1') DEFAULT '0',
`pgp_two_factor` enum('0','1') DEFAULT '0',
PRIMARY KEY (`id`),
UNIQUE KEY `user_hash` (`user_hash`,`user_name`),
KEY `user_name` (`user_name`,`user_hash`,`banned`,`entry_paid`,`register_time`,`user_role`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

INSERT INTO `bw_users` (`banned`, `block_non_pgp`, `entry_paid`, `force_pgp_messages`, `location`, `login_time`, `display_login_time`, `password`, `public_key`, `private_key`, `private_key_salt`, `register_time`, `salt`, `pgp_two_factor`, `user_hash`, `user_name`, `user_role`, `local_currency`, `completed_order_count`, `totp_two_factor`, `totp_secret`) VALUES
('0', '0', '1', '0', 1, 0, '0', '%PASSWORD%', '%PUBLIC_KEY%', '%PRIVATE_KEY%', '%PRIVATE_KEY_SALT%', %REGISTER_TIME%, '%SALT%', '0', '%USER_HASH%', 'admin', 'Admin', 0, 0, '0', '');
Reply

#7
Can you attache a full SQL file?
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.