Questions about albums table

Hello,
I have several questions regarding Zenphoto (1.5.9)
In the "albums" table, in the title field, I sometimes have plain names, example: "mine workers", and sometimes I have additional characters. Example "a:1:{s:5:"fr_FR";s:19:"The Henri-Paul well";}". For what reason please? How to make sure to only have clear names?
Then, in this same table, I need to retrieve the "show" field, but it is not possible because "show" is a reserved word for Mysql. How to get around this problem? Thank you in advance for your answers.

Comments

  • sbillard Member
    edited September 2022

    the different representations in the album title are normal. Generally this field stores multi-lingual content. (That is what the fr_FR tag is--French.)

    You really should not be directly accessing the database entries. Especially if you are not completely familiar with the Zenphoto implementation. There are object methods and functions that deal properly with the content. For instance getLanguageString($album->getTitle()) will retrieve the appropriate text string for the title.

    As to the show field. You need to indicate to mySQL that you are referencing a field. Again, familiarity with the tools is needed if you want to access the root database entries. For "show" (and any other field) put the field name in peck marks (`).

  • Can you help me a little please?
    I have this SELECT query:

    $sql = "SELECT id, folder, title, show, updateddate FROM vlma_albums ORDER BY id";

    I don't know how to use the function that removes extra characters in the title field.
    For example, I want to get "Mining trades" instead of "a:1:{s:5:"fr_FR";s:23:"Mining trades";}"
    Thank you in advance for your help

  • acrylian Administrator, Developer
    edited September 2022

    As already mentioned you should not use direct queries if avoidable, use the object model instead. Please see here:
    https://www.zenphoto.org/news/zenphotos-object-model-framework/

    If your really, really need a direct query - which in this case you don't - use getLanguageString() as already mentioned above. You have to do that after querying the data. You find info about all classes, their methods and functions here: https://docs.zenphoto.org/

    But before you do these kind of stuff, I strongely suggest to read the theming tutorial for the absolute theme basics first if you haven't: https://www.zenphoto.org/news/theming-tutorial/

  • Don't worry, don't want to "break" my zenphoto. I only need the info I quoted above in another program that has nothing to do with zenphoto. And my little program uses a direct mysql query. In this case, a simple select.

  • acrylian Administrator, Developer

    Well, still you need to follow what Zenphoto does. The string is serialized and can be unserialized via native PHP functions. However only the Zenphoto function covers the correct handling regarding multilingual. And the string is generally always that way even if you don't use multilingual: https://www.zenphoto.org/news/problems-with-languages/ (way down)

Sign In or Register to comment.