Posted on : 2018-10-29 12:09:06 View Type: public
william busse

gender feild has no default value.. wil not finish installing.. php version 7.2.9 mysql version 5
gender feild has no default value.. wil not finish installing.. php version 7.2.9 mysql version 5
Please edit the file in script >> includes >> database_installation.php and find the following lines.
if($db->query('SELECT 1 from users') == FALSE) {
$query = 'CREATE TABLE users (
`user_id` bigint(20) NOT NULL AUTO_INCREMENT,
`first_name` varchar(100) NOT NULL,
`last_name` varchar(100) NOT NULL,
`gender` varchar(50) NOT NULL,
`date_of_birth` date NOT NULL,
`address1` varchar(200) NOT NULL,
`address2` varchar(200) NOT NULL,
`city` varchar(100) NOT NULL,
`state` varchar(100) NOT NULL,
`country` varchar(100) NOT NULL,
`zip_code` varchar(100) NOT NULL,
`mobile` varchar(200) NOT NULL,
`phone` varchar(200) NOT NULL,
`username` varchar(100) NOT NULL,
`email` varchar(200) NOT NULL,
`password` varchar(200) NOT NULL,
`profile_image` varchar(500) NOT NULL,
`description` varchar(600) NOT NULL,
`status` varchar(100) NOT NULL,
`activation_key` varchar(100) NOT NULL,
`date_register` date NOT NULL,
`user_type` varchar(100) NOT NULL,
PRIMARY KEY (`user_id`)
)';
$result = $db->query($query) or die($db->error);
echo 'Users Table created.<br>';
} //Creating users table ends here.
and change them with the following lines.
if($db->query('SELECT 1 from users') == FALSE) {
$query = 'CREATE TABLE users (
`user_id` bigint(20) NOT NULL AUTO_INCREMENT,
`first_name` varchar(100) NULL,
`last_name` varchar(100) NULL,
`gender` varchar(50) NULL,
`date_of_birth` date NULL,
`address1` varchar(200) NULL,
`address2` varchar(200) NULL,
`city` varchar(100) NULL,
`state` varchar(100) NULL,
`country` varchar(100) NULL,
`zip_code` varchar(100) NULL,
`mobile` varchar(200) NULL,
`phone` varchar(200) NULL,
`username` varchar(100) NOT NULL,
`email` varchar(200) NOT NULL,
`password` varchar(200) NOT NULL,
`profile_image` varchar(500) NULL,
`description` varchar(600) NULL,
`status` varchar(100) NOT NULL,
`activation_key` varchar(100) NULL,
`date_register` date NOT NULL,
`user_type` varchar(100) NOT NULL,
PRIMARY KEY (`user_id`)
)';
$result = $db->query($query) or die($db->error);
echo 'Users Table created.<br>';
} //Creating users table ends here.
The problem you received cause your database settings are set to strict which do not allow empty fields for not null fields. That's why i suggested you to make them able to remain empty. Please make sure you delete all tables from the database after this change and run installation again. Everything should go find in that case.
ok thats done, now once i log in It displays the message ' feild message_email has no default value' should i be changing all values that are 'not null ' to null?
Please change everything in database_installation.php with the attached code. And run installation again.
<?php
if(!defined('ACCESSDBINS')) {
die('Direct access not permitted');
}
//Database Connection file. Update with your Database information once you create database from cpanel, or mysql.
if($db->query('SELECT 1 from user_meta') == FALSE) {
$query = 'CREATE TABLE user_meta (
`user_meta_id` bigint(20) NOT NULL AUTO_INCREMENT,
`user_id` bigint(20) NOT NULL,
`message_email` varchar(50) NULL,
`last_login_time` datetime NOT NULL,
`last_login_ip` varchar(120) NOT NULL,
`login_attempt` bigint(20) NOT NULL,
`login_lock` varchar(50) NOT NULL,
PRIMARY KEY (`user_meta_id`)
)';
$result = $db->query($query) or die($db->error);
echo 'User Meta Table created.<br>';
} //Creating user notes table ends here.
if($db->query('SELECT 1 from message_meta') == FALSE) {
$query = 'CREATE TABLE message_meta (
`msg_meta_id` bigint(20) NOT NULL AUTO_INCREMENT,
`message_id` bigint(20) NOT NULL,
`status` varchar(100) NOT NULL,
`from_id` bigint(20) NOT NULL,
`to_id` bigint(20) NOT NULL,
`subject_id` bigint(20) NOT NULL,
PRIMARY KEY (`msg_meta_id`)
)';
$result = $db->query($query) or die($db->error);
echo 'Message Meta Table created.<br>';
} //Creating user notes table ends here.
if($db->query('SELECT 1 from messages') == FALSE) {
$query = 'CREATE TABLE messages (
`message_id` bigint(20) NOT NULL AUTO_INCREMENT,
`message_datetime` datetime NOT NULL,
`message_detail` varchar(1000) NULL,
PRIMARY KEY (`message_id`)
)';
$result = $db->query($query) or die($db->error);
echo 'Messages Table created.<br>';
} //Creating user notes table ends here.
if($db->query('SELECT 1 from subjects') == FALSE) {
$query = 'CREATE TABLE subjects (
`subject_id` bigint(20) NOT NULL AUTO_INCREMENT,
`subject_title` varchar(600) NULL,
PRIMARY KEY (`subject_id`)
)';
$result = $db->query($query) or die($db->error);
echo 'Subjects Table created.<br>';
} //Creating user notes table ends here.
if($db->query('SELECT 1 from notes') == FALSE) {
$query = 'CREATE TABLE notes (
`note_id` bigint(20) NOT NULL AUTO_INCREMENT,
`note_date` date NOT NULL,
`note_title` varchar(200) NULL,
`note_detail` varchar(600) NULL,
`user_id` bigint(20) NOT NULL,
PRIMARY KEY (`note_id`)
)';
$result = $db->query($query) or die($db->error);
echo 'Notes Table created.<br>';
} //Creating user notes table ends here.
if($db->query('SELECT 1 from announcements') == FALSE) {
$query = 'CREATE TABLE announcements (
`announcement_id` bigint(20) NOT NULL AUTO_INCREMENT,
`announcement_date` date NOT NULL,
`announcement_title` varchar(200) NULL,
`announcement_detail` varchar(1000) NULL,
`user_type` varchar(100) NOT NULL,
`announcement_status` varchar(50) NOT NULL,
PRIMARY KEY (`announcement_id`)
)';
$result = $db->query($query) or die($db->error);
echo 'Notes Table created.<br>';
} //Creating user notes table ends here.
//if database tables does not exist already create them.
if($db->query('SELECT 1 from options') == FALSE) {
$query = 'CREATE TABLE options (
`option_id` bigint(20) NOT NULL AUTO_INCREMENT,
`option_name` varchar(500) NULL,
`option_value` varchar(500) NULL,
PRIMARY KEY (`option_id`)
)';
$result = $db->query($query) or die($db->error);
echo 'Options Table created.<br>';
} //creating options table.
if($db->query('SELECT 1 from users') == FALSE) {
$query = 'CREATE TABLE users (
`user_id` bigint(20) NOT NULL AUTO_INCREMENT,
`first_name` varchar(100) NOT NULL,
`last_name` varchar(100) NULL,
`gender` varchar(50) NULL,
`date_of_birth` date NULL,
`address1` varchar(200) NULL,
`address2` varchar(200) NULL,
`city` varchar(100) NULL,
`state` varchar(100) NULL,
`country` varchar(100) NULL,
`zip_code` varchar(100) NULL,
`mobile` varchar(200) NULL,
`phone` varchar(200) NULL,
`username` varchar(100) NOT NULL,
`email` varchar(200) NOT NULL,
`password` varchar(200) NOT NULL,
`profile_image` varchar(500) NULL,
`description` varchar(600) NULL,
`status` varchar(100) NOT NULL,
`activation_key` varchar(100) NOT NULL,
`date_register` date NOT NULL,
`user_type` varchar(100) NOT NULL,
PRIMARY KEY (`user_id`)
)';
$result = $db->query($query) or die($db->error);
echo 'Users Table created.<br>';
} //Creating users table ends here.
//if database tables does not exist already create them.
if($db->query('SELECT 1 from user_level') == FALSE) {
$query = 'CREATE TABLE user_level (
`level_id` bigint(20) NOT NULL AUTO_INCREMENT,
`level_name` varchar(200) NOT NULL,
`level_description` varchar(600) NULL,
`level_page` varchar(100) NULL,
PRIMARY KEY (`level_id`)
)';
$result = $db->query($query) or die($db->error);
echo 'Options Table created.<br>';
} //creating user level table ends.
//if database tables does not exist already create them.
if($db->query('SELECT 1 from website_labels') == FALSE) {
$query = 'CREATE TABLE website_labels (
`id` int(11) NOT NULL AUTO_INCREMENT,
`category` varchar(255) NOT NULL,
`field` varchar(255) NULL,
`result` longtext NULL,
PRIMARY KEY (`id`)
)';
$result = $db->query($query) or die($db->error);
echo 'Website Labels Created.<br>';
} //creating user level table ends.
ok now that ive replaced the contents of that file i still get an error after installation and logging in of admn.. feild 'activate_key ' has no default value
You can make that as Null too. activate_key
Here if ound the reasons of why this is happening on internet.
ERROR 1364 (HY000): Field 'price' doesn't have a default value
price decimal(6,2) NOT NULL,
Set price to null or assign a default value
EDIT:
This is caused by the STRICT_TRANS_TABLES
SQL mode.
Open phpmyadmin and goto More
Tab and select Variables
submenu. Scroll down to find sql mode. Edit sql mode and remove STRICT_TRANS_TABLES
Save it.
OR
You can run an SQL query within your database management tool, such as phpMyAdmin: -- verified that the mode was previously set select @@GLOBAL.sql_mode; -- UPDATE MODE SET @@global.sql_mode= 'YOUR_VALUE';
OR
Find the line that looks like so in the mysql conf file:
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
Comment above line out and restart mysql server