Results 1 to 4 of 4

Thread: Update/copy a blob-field

  1. #1
    New user
    Join Date
    04-03-11.
    Posts
    10

    Default Update/copy a blob-field

    Hi,
    I need to update a blob-field via phpmyadmin. Can someone please tell me how to do that?

    I've tried to use update, but can't figure out how to write it.
    The fields I want to be public is shown below. In the database and the table tl_member the column publicFields is a blob.

    UPDATE `tl_member` SET `publicFields`="firstname" & "lastname" & "mobile" & "email" & "phone" & "xt_land" & "xt_position" & "xt_region" & "xt_year" & "avatar" WHERE `id`=1820

    If its possible to copy a blob somehow, and paste it that would be great.

    I have read pages on unserializing, but I don't understand it! Also, I have seen on this forum that there is a function called deserialize, but I don't know if/how a deserialized blob can be copied or edited.

    I'm sorry for my newbie question!

    /Annika

  2. #2
    Experienced user
    Join Date
    06-20-09.
    Posts
    1,311

    Default Re: Update/copy a blob-field

    I need to update a blob-field via phpmyadmin.
    I'm no expert but I don't think you can unless you enter the data in serialized form, which requires php processing.
    What is in the blob is not data as such, but a representation of the data (so not easily manipulated - ie: you can't search or query it in MySQL)

    I have read pages on unserializing, but I don't understand it!
    Contao enters data into certain fields as a serialized array. (eg: the member groups and, as you point out, the publicFields).

    To see this data in "real" form requires unserializing (a php function) to get an array , and then looping the array to get its parts.

    This probably won't help you, but for me to print the serialized array "openhome_dates" onto an html page via the variable "calendarshow" , I need to do this:
    Code:
    $openhomes = deserialize($objHousesella->openhome_dates);
    if(is_array($openhomes) && count($openhomes) > 0)
    {
        $calendarshow .= '<div class="openhome_dates">';
        foreach($openhomes as $openhome)
        {
              $calendarshow .= '<div class="openhome_date">
                                               <span class="listinglabel openhomelabel">Start: </span><span class="listingtext openhomestart">'.$openhome[0].'</span>
    		            <span class="listinglabel openhomelabel">End: </span><span class="listingtext openhomeend">'.$openhome[1].'</span>
    		    </div>';
         }					
         $calendarshow .= '</div>';		
    }
    "openhome_dates" consists of an undetermined number of rows of two dates, which the foreach loop outputs each loop as $openhome[0] and $openhome[1].

    Likewise, inserting the data into MySql requires it to be made into an array, and then serialized before insertion.
    Contao, or a custom widget, generally handles this.

    I think deserializing (which is a Contao function, not a php one) does both at once.

    I'm sorry for my newbie question!
    It ain't no newbie question, its a damned complicated process. There is talk of doing away with this in a future Contao version in favour of readable csv values.

  3. #3
    New user
    Join Date
    04-03-11.
    Posts
    10

    Default Re: Update/copy a blob-field

    Thank you for you answer Ramjet!

    So, there is no way to copy a Blob then, or does anyone know a way (and have the time to tell me ) how to deserialize and serialize the data and then how to put in the data into the database?

    Maybe it's better to make a template which gives all new members the same public data, so that it's already set somehow. Someone who knows how to do this?

    /Annika

  4. #4
    User
    Join Date
    06-19-09.
    Posts
    328

    Default Re: Update/copy a blob-field

    Quote Originally Posted by AnnikaW
    Thank you for you answer Ramjet!

    So, there is no way to copy a Blob then, or does anyone know a way (and have the time to tell me ) how to deserialize and serialize the data and then how to put in the data into the database?

    Maybe it's better to make a template which gives all new members the same public data, so that it's already set somehow. Someone who knows how to do this?

    try adding to "system/config/dcaconfig.php" the following entry:

    Code:
    $GLOBALS['TL_DCA']['tl_member']['fields']['publicFields']['default'] = array('firstname', 'lastname', 'mobile');

    However I do not know from which extension comes the "publicFields" field in tl_member
    Consulenza Contao CMS https://www.intco.it

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •