Field 'log_id' doesn't have a default value

Username (e.g. epiz_XXX) or Website URL

(please specify the website or account you are asking about)

Error Message

Field ‘log_id’ doesn’t have a default value

(please share the FULL error message you see)

Other Information

(other information and details relevant to your question)

What is your table structure? What is the SQL query? Please provide information if you want help.

3 Likes

can you check my website via remote ?
please

I cannot because it is a login page, and you did not provide any test login credentials. If you would not like to share them publicly, you can PM them to me by clicking my profile icon.

<?php $conn = new mysqli('sql103.epizy.com', 'epiz_31108007', 'removed', 'epiz_31108007_localhost'); if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } ?>

this is my db connection i thinks there is a problem here?

Yes, that statement looks correct. Is the table’s name ‘localhost’?

1 Like

honestly im just trying my system run online
when using xamp its running without error
id
username
password
firstname
lastname
photo

yes localhost

log_id doesn’t have a default value because that column doesn’t exist.


Remember:

it runs in awardspace while here im having problem

Table Create Table
admin CREATE TABLE admin (
id int(11) NOT NULL AUTO_INCREMENT,
username varchar(30) NOT NULL,
password varchar(60) NOT NULL,
firstname varchar(50) NOT NULL,
lastname varchar(50) NOT NULL,
photo varchar(200) NOT NULL,
created_on date NOT NULL,
PRIMARY KEY (id)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1
employee_attendance CREATE TABLE employee_attendance (
id int(11) NOT NULL AUTO_INCREMENT,
employee_id int(11) NOT NULL,
date_attendance date NOT NULL,
time_in time NOT NULL,
status int(1) NOT NULL,
time_out time NOT NULL,
number_of_hour double NOT NULL,
PRIMARY KEY (id)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1
employee_cashadvance CREATE TABLE employee_cashadvance (
id int(11) NOT NULL AUTO_INCREMENT,
employee_id varchar(255) DEFAULT NULL,
amount varchar(255) DEFAULT NULL,
date_created varchar(255) DEFAULT NULL,
PRIMARY KEY (id)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1
employee_deductions CREATE TABLE employee_deductions (
id int(11) NOT NULL AUTO_INCREMENT,
deduction_name varchar(255) DEFAULT NULL,
amount double DEFAULT NULL,
date_create varchar(255) DEFAULT NULL,
PRIMARY KEY (id)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1
employee_overtime CREATE TABLE employee_overtime (
id int(11) NOT NULL AUTO_INCREMENT,
employee_id varchar(15) NOT NULL,
overtime_hours double NOT NULL,
overtime_mins double NOT NULL,
overtime_date varchar(200) NOT NULL,
PRIMARY KEY (id)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1
employee_position CREATE TABLE employee_position (
id int(11) NOT NULL AUTO_INCREMENT,
emp_position varchar(255) DEFAULT NULL,
rate_per_hour double DEFAULT NULL,
date_added varchar(255) DEFAULT NULL,
PRIMARY KEY (id)
) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=latin1
employee_records CREATE TABLE employee_records (
emp_id int(11) NOT NULL AUTO_INCREMENT,
employee_id varchar(255) DEFAULT NULL,
first_name varchar(255) DEFAULT NULL,
middle_name varchar(255) DEFAULT NULL,
last_name varchar(255) DEFAULT NULL,
complete_address varchar(255) DEFAULT NULL,
birth_date varchar(255) DEFAULT NULL,
Mobile_number varchar(255) DEFAULT NULL,
gender varchar(255) DEFAULT NULL,
position_id int(11) DEFAULT NULL,
marital_status varchar(255) DEFAULT NULL,
schedule_id int(11) DEFAULT NULL,
profile_pic varchar(255) DEFAULT NULL,
date_created varchar(255) DEFAULT NULL,
PRIMARY KEY (emp_id)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1
employee_schedule CREATE TABLE employee_schedule (
id int(11) NOT NULL AUTO_INCREMENT,
time_in varchar(255) DEFAULT NULL,
time_out varchar(255) DEFAULT NULL,
date_added varchar(255) DEFAULT NULL,
PRIMARY KEY (id)
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=latin1
history_log CREATE TABLE history_log (
log_id int(11) NOT NULL,
id int(11) NOT NULL,
email_address text NOT NULL,
action varchar(100) NOT NULL,
actions varchar(200) NOT NULL DEFAULT ‘Has LoggedOut the system at’,
ip text NOT NULL,
host text NOT NULL,
login_time varchar(200) NOT NULL,
logout_time varchar(200) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
login_admin CREATE TABLE login_admin (
id int(11) NOT NULL AUTO_INCREMENT,
name text NOT NULL,
email_address text NOT NULL,
user_password text NOT NULL,
user_status varchar(50) NOT NULL,
PRIMARY KEY (id)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1

This only says that column log_id cannot be null. You didn’t actually assign it a default value.

2 Likes

so what will i change haha i dont know

Try:

`log_id` int(11) NOT NULL DEFAULT 0;

This creates column log_id as an integer with length 11, which cannot be null and has a default value of 0.

1 Like

sorry i dont know how to execute online

i am really noob here

ALTER TABLE login_admin CHANGE id id INT(11) NULL DEFAULT ‘0’ AUTO_INCREMENT;

Use the SQL tab from PHPMyAdmin. Also, make sure you have some knowledge before running your application.

1 Like

1 errors were found during analysis.

  1. A closing bracket was expected. (near “0” at position 221)

SQL query:

– – Database: epiz_31108007_localhost – – -------------------------------------------------------- – – Table structure for table admin – CREATE TABLE admin ( log_id int(11) NOT NULL DEFAULT 0

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.