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 7564721
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T13:58:07+00:00 2026-05-30T13:58:07+00:00

I am setting up a website which stores a large (serialized) array of arrays

  • 0

I am setting up a website which stores a large (serialized) array of arrays specific to each user. The large array is serialized and then the database is updated to its new value. Also, the new array is added to the $_SESSION[] array which is used for the period the user is logged in. I can UPDATE the array fine with up to 4 of these arrays in the large array but after that the data does not seem to UPDATE properly.

The MySQL UPDATE query returns 1 even after the 3rd array has been added and the $_SESSION[] array seems to contain all the right data but when the user logs out and then back in again, the array does not seem to be copied to the $_SESSION[] array as it should whenever the user logs in. If only 4 of these arrays are stored in the large array, the data can be fetched from the database no problem. I increased the length of the database field beyond what would be required (and then increased it faaaar beyond what should be required) but it did not help.

When I go to phpMyAdmin, I can see that the array is updated successfully until after array 3 when the serialised array stops abruptly (in the middle of a sentence in the serialised array) but I think this might be an issue with phpMyAdmin because alongside the array edit box it says ‘Because of its length, this field might not be editable’ so maybe phpMyAdmin is just not bothering to load the rest of the array into the tiny textarea.

Is there anything I can do to fix this issue? Is there anything I may not be aware of (I am a beginner with MySQL but it seems to have been working okay up until now).

The code used to update the database is like this:

$_SESSION['data']['user']['templates'][$_SESSION['edit']['templateNo']] = $template;
$serializedTemplates = mysql_real_escape_string(serialize($_SESSION['data']['user']['templates']));
$serializedReports = mysql_real_escape_string(serialize($_SESSION['data']['user']['reports']));
$email = mysql_real_escape_string($_SESSION['data']['user']['details']['email']);
$returned = mysql_query("UPDATE rmusers SET templates='$serializedTemplates', reports='$serializedReports' WHERE email='$email'") or die (mysql_error());

The ‘reports’ and ’email’ array elements are not really relevant.

The code used to retrieve the array from the database is like this:

$result = mysql_query("SELECT * FROM rmusers WHERE email='" . $_POST['email'] ."'");
$userRow = mysql_fetch_array($result);
if (strlen(unserialize($userRow['templates'])) > 0)
{
    $_SESSION['data']['user']['templates'] = unserialize($userRow['templates']);
}

Also, sorry I have used the word ‘array’ about 25 times in the above question 🙂

  • 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-30T13:58:08+00:00Added an answer on May 30, 2026 at 1:58 pm

    Your field type is text, which has a maximum length of 65535 characters. Switch over to longtext, that has a theoretical limit of 4GB. However keep in mind that the docs says:

    The effective maximum length of LONGTEXT columns also depends on the configured maximum packet size in the client/server protocol and available memory.

    Also see the documentation of the max_allowed_packet setting:

    The protocol limit for max_allowed_packet is 1GB.

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

Sidebar

Related Questions

I'm setting up a website which ultimately displays videos. The video files are all
I'm in the process of setting up a new website which would greatly benefit
I'm setting up a Jabber server for my website. I've already got some user
I have a website in which I am setting up a log in for
I'm a beginner in Django. I need to setup a website, where each user
I am programming a website in which users will have a number of settings,
I'm currently in the process of setting my website, largely with php. Though this
I'm interested in setting up my own website-based game (PBBG) as a hobby. Traffic
I am setting up a test version of my website against a new schema.
I am working on setting up a Drupal based website and wanted to replace

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.