Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7557981
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T12:16:23+00:00 2026-05-30T12:16:23+00:00

unfortunately I have not found anything yet, maybe anyone could help me or give

  • 0

unfortunately I have not found anything yet, maybe anyone could help me or give me a hint?

I have a table called “users” and a field “last_login” where I want to store the login dates of the last let’s say 30 logins. So, each time the user logs in successfully, the timestamp should be added at the end of the string, so it looks sth like this:

logdindate1;logindate2;logindate3;…

..whereas logindates are timestamps with a certain size. However, if we reach logindate31, logindate1 should be deleted and logindate31 added at the end.

Is there any way to do that very easily within the MySQL query or do I have to check length with php? If yes, will I need a SELECT, then check the length, cut it and then a separate UPDATE? Or is there any better way to do it at all?

The query I have till now is (it does not check the length or cut anything):

<?php $query = "UPDATE user SET login_date = CONCAT(login_date,'".$logindate.";') WHERE id='".$user_id."';"; ?>

Thank you very much in advance!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T12:16:24+00:00Added an answer on May 30, 2026 at 12:16 pm

    Create a table login_history and insert the new login date there. Use a JOIN to retrieve the login dates of a user.

    I strongly recommend you get a basic understanding of what’s called “Database normalization”

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I see that this has been asked many times. But, unfortunately I have not
I have six tables, which unfortunately does not have any primary/foreign key-relations encoded. I've
I'm doing some fairly simple cross-platform TCP socket programming. I have unfortunately found out
I try understand what happens from some tutorials but unfortunately I am not found
I have an issue with jquery where elements are not found when the query
maybe you can help me out here. I have an issue with my codeigniter
Unfortunately I have a pretty bad understanding of how to properly set up threading.
Unfortunately I have to do some interaction with IBM's UniData database system. I am
We have TRAC 0.11 server. Unfortunately we have deleted a milestone in one of
Unfortunately I don't have access to JQuery and all it's nicety. But I do

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.