DB Error: Unknown column 'u.last_name' in 'order clause'

Our site is getting this error " DB Error: Unknown column ‘u.last_name’ in ‘order clause’ " and we cannot log in anymore.

Seeing the DB throug phpMyAdmin, I realize that there’s no column named ‘last_name’ nor ‘first_name’. This is affecting our website since the names of the authors or users are not displayed.

We are using OJS 3.1 and PHP 5.6.4 and the logs in Plesk aren’t showing any errors with the PHP.

Can anyone help me with this? Thanks in advance.

Are you using OJS 3.1.1 or OJS 3.1.2? In 3.1.2, user (and author) names have been localized and the database structure has changed. If you’ve changed your database structure or upgraded your OJS code recently, they may be out of sync now.

Cheers,
Jason

Hello, Jason!

Sorry for the late answer, we had experiment some issues with our ISP.

We’re using OJS 3.1.0.1, but when the site was showing the error there wasn’t any upgrade running in the site. And there was no change made by us in the DB since we’re using OJS 3.1.0.1

Hi @daniel.anez

In that case can you look at the users table and see if those columns are there? They definitely should be.

Cheers,

Hi @jnugent

I did look the users table and there is not any columns with “first_name” or “last_name”. I double checked that the DB was the one assinged to the site and not the one we use to the dev site.

There’s another reason for the DB to change in OJS 3.1.0.1?

Hi @daniel.anez

I don’t think you’re using a 3.1.0.1 database. If you look at the schema definition for 3.1.0.1 there are first, middle, and last name columns in the users table:

I suggest you look at your versions table and find entries that have the word “core” in them to see if someone has changed the database or upgraded it accidentally from a different installation. The versions table will tell you what version your OJS install is, or you can look at the Site Administrator tab. Do you have recent backups? You may need to restore.

Cheers,
Jason

Hello, Jason.

I’m sorry for the late response. We ended restoring a backup on the site. We really don’t know why the DB has changed. Any idea why the DB change with no OJS update on our server recently?

Hello, Jason!

I’m very ashamed for the late response, I’m sorry.

I have found the problem. We had tryed a new installation of OJS 3.1.2 on our dev site, which is running on the same server that te production site, but in a different subscription.

Well, we didn’t change the db name, db username and the db password on the config.inc.php when we did the installation and that was the error.

The new installation was affecting our production DB. When we noticed that and we change de db info, everything ran just fine.

Thank you very much for your attention!

1 Like

Hi @daniel.anez

Great! Glad it worked out (and apologies for my own late response - I am at a conference at the moment)

Cheers
Jason