Skip to content
Advertisement

Tag: php

Select count(column) from table of mysql in php

I have a database and I am trying to make a website and connect it to my database. I am trying to count the number of instances in a column but I am having trouble. I have this so far: Answer I hope you have the connection done. Here something is column which you are using to filter the output

how to successfully add a foreign key constraint to your Database table in laravel using eloquent?

I have a database containing two Tables(students, payments) with id as primary key and another column studentID within the students Table. Am making studentID a foreign key in payments Table. I am getting this error message: SQLSTATE[42000]: Syntax error or access violation: 1072 Key column ‘studentID’ doesn’t exist in table (SQL: alter table payments add constraint payments_studentid_foreign foreign key (studentID)

How to get the SUM of 3 individual columns in codeigniter

I am trying to get the SUM of 3 individual columns. When I try to output I get nothing. What do I do wrong? Model Controller View Answer $this->db->select() accepts an optional second parameter. If you set it to FALSE, CodeIgniter will not try to protect your field or table names. This is useful if you need a compound select

Cron job to update row after 5 days

I’m having difficulty to make a cron job on cpanel to update the state of an user if the account has been created for 5 days. It just doesn’t work at all. When I program the cron job on the cpanel it …

Advertisement