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

  • Home
  • SEARCH
  • 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 6910227
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T08:47:16+00:00 2026-05-27T08:47:16+00:00

I am build a data structure using multidimensional associative arrays. Can I update that

  • 0

I am build a data structure using multidimensional associative arrays. Can I update that data structure into a mysql table field and then read it back again?

Here is an example of what I am trying to do:

$result = mysql_query("select * FROM color") or die(mysql_error());
$colors = "";
while($colorrec = mysql_fetch_array($result)){
 $colors[$colorrec['ID']][0] = $colorrec['Description'];
 $colors[$colorrec['ID']][1] = $colorrec['HexCode'];
}

If I now do:

mysql_query("UPDATE tempfile SET ColorInfo = '".$colors."' WHERE ID = '".tempID."'");

Can I then do:

$result = mysql_query("select * from tempfile WHERE ID = '".tempID."'");
$temprec = mysql_fetch_array($result);
$colors = $temprec['ColorInfo'];
  • 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-27T08:47:16+00:00Added an answer on May 27, 2026 at 8:47 am

    You could serialize it to hold it’s data type, then unserialize it when you fetch it back.

    $result = mysql_query("select * FROM color") or die(mysql_error());
    $colors = array();
    while($colorrec = mysql_fetch_array($result)){
      $colors[$colorrec['ID']] = array($colorrec['Description'], $colorrec['HexCode']);
    }
    
    mysql_query("UPDATE tempfile SET ColorInfo = '".serialize($colors)."' WHERE ID = '".$tempID."'");
    
    $result = mysql_query("select * from tempfile WHERE ID = '".$tempID."'");
    $temprec = mysql_fetch_array($result);
    $colors = unserialize($temprec['ColorInfo']);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need some data structure that I can build from standard collections or using
I am trying to build a data table structure that will best support the
If I notice that a hash table (or any other data structure built on
I am using MySQL and PHP to build a data layer for a flash
I'm trying to build up the proper data structure using a pseudo tcp header,
I would like to build an in-memory table data structure with 4 columns so
I'm trying to properly write code to build a data structure to serialize into
I was trying to implement a Piece Table data structure using Linked Lists in
I am trying to build a Quadtree data structure(or let's just say a tree)
I'm looking for a Java built-in data structure that would be the best at

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.