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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T07:50:15+00:00 2026-05-21T07:50:15+00:00

I’m very new to MySQL, although I’ve used SQL databases in other contexts before.

  • 0

I’m very new to MySQL, although I’ve used SQL databases in other contexts before. I have a test site set up which has an online cPanel with access to phpMyAdmin. I’m attempting to setup a MySQL database, and so far it’s working fine (I can connect to the Database and the table).

The only problem I’m having is with inserting data. I’d like to insert an entire array (specifically, the array will be a double[]) into one column. After looking at the column types available in phpMyAdmin, it doesn’t seem to support inserting arrays other than Binary arrays.

I’ve found many solutions for inserting arrays programatically including this thread, but for this site we will be inserting data via the online cPanel. Is there a way to do that?

  • 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-21T07:50:16+00:00Added an answer on May 21, 2026 at 7:50 am

    If you want access to that data, and want to be able to use the power of SQL to search in your double[], you should do it this way:

    First, you should spend some time researching relational databases. They allow you to create linked data.

    An important part of every relational database is using good keys. A key is a unique identifier for a row that allows you to access the data on that row in an efficient manner.

    Another important part of relational databases are indexes. Indexes are not required to be unique. But are useful if you are trying to search on them (SQL has made an “index” of the table based on a column or group of columns)

    If you wanted to create a table that would have a double[] array, you might instead create a 2nd table that relates to the first table by the first tables primary key.

    CREATE TABLE base (
        base_id INT AUTO_INCREMENT,
        name    VARCHAR(32),
        PRIMARY KEY(base_id)
    );
    
    CREATE TABLE darray (
        base_id INT,
        data    DOUBLE,
        INDEX(base_id)
    );
    

    To get the information back out that you want, you can select using a JOIN statement. If you wanted to get all the information where the base_id was 3, you would write it like so:

    SELECT * FROM base
        JOIN darray ON darray.base_id = base.base_id
    WHERE base.base_id = 3;
    

    The advanced form of writing this with aliasing

    SELECT * FROM base b
        JOIN darray d ON d.base_id = b.base_id
    WHERE b.base_id = 3;
    

    If you don’t want to have access to the data, but are just recalling it, you should do it this way: (Although this is debatable, I still recommend the above way, if you are willing to learn more sql)

    I assume you will be using PHP, we will be serializing the data (see: http://php.net/manual/en/function.serialize.php)

    Note we will don’t have the darray table, but instead add a

    data    BLOB
    

    to the base table.

    Inserting with PHP serialized data

    <?php
    $serializedData = serialize($darray);
    $result = mysql_query("INSERT INTO base (name, data) VALUES('a name', '$serializedData ')");
    

    Getting the serialized data

    <?php
    $result = mysql_query("SELECT data FROM base WHERE base_id=3");
    if($result && mysql_affected_rows($result) > 0) {
        $serializedData = mysql_result($result, 0, 'data');
        $darray = unserialize($serializedData);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a French site that I want to parse, but am running into
I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I used javascript for loading a picture on my website depending on which small
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
I want use html5's new tag to play a wav file (currently only supported
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this

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.