• Hi Tobias,

    We accidentally somehow messed up one of our wp-reloaded tables and I went to restore from a sql backup. The table 15’s wp_options option_id is 981 and when I paste this in to option_value:

    https://pastebin.com/tZdeKBMs

    …my live WordPress theme page outputs this:

    [table “15” seems to be empty /]

    In my admin table 15 has “no name”, “no description” and no data.

    Is it possible to restore this table data?

    Vielen Dank!

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Tobias B?thge

    (@tobiasbg)

    Hi,

    this happens if the serialized string from the database can not properly decoded into an array.
    In your case this seems to happen due to the use of “addslashes” (a PHP function that adds \ to string to encode certain things) by the SQL backup functionality.

    I successfully recovered the code for this, which correctly restores the table on my server. Please try again with https://pastebin.com/4gvGmaaY

    If that does not help, I can also provide a CSV export of the table, if you want.

    Regards,
    Tobias

    Thread Starter ryansebiz

    (@ryansebiz)

    Thank you so much Tobias – you’re a genius! You really saved us!

    Just out of curiosity, how did you remove the slashes from the pastebin code? If this comes up again I’d be interested to know how to take care of it.

    Herzlichen Dank!

    Plugin Author Tobias B?thge

    (@tobiasbg)

    Hi Ryan,

    thanks for the confirmation that this worked.

    Basically, I simply ran the code through the PHP function “stripslashes()”.
    I did however not use a PHP script for that, but used a nice tool that provides that function without having to create a script: https://www.tools4noobs.com/online_php_functions/stripslashes/

    Now, after trying the output from that, I still had the same problem. That’s when I saw that I might have actually stripped too many slashes: Those within the table cells (in your case especially those infront of ') needed to be kept.
    I didn’t really know how to re-add those (a simple search and replace should actually work, if I think about it now), so I tried unserializing the string with
    https://www.functions-online.com/unserialize.html
    (which is another PHP function that converts the string to an “array”).
    The failing of this on that site is for the same reason that it fails in the plugin.
    But, the output of the site is useful: It delivered the string with ' correctly escaped.
    So, I simply copied the output in the lower part of the screen, but only the part between unserialize(' and ');, so one has to be careful there a little bit.
    And with that pasted into the database, the table worked again ??

    (As a final remark: As you are having some rather large tables, I suggest to regularly perform backups by exporting to CSV as well. That should save you some trouble, in case the SQL restoring results in problems like this.)

    Best wishes,
    Tobias

    Thread Starter ryansebiz

    (@ryansebiz)

    Hi Tobias – thanks for the PHP tools. I’ve also exported all the tables as semicolon-separated CSV files (so hopefully the PHP tools won’t be needed).

    I really appreciate your support of this awesome plugin.

    Danke schon!

    Plugin Author Tobias B?thge

    (@tobiasbg)

    Hi Ryan,

    indeed, the CSV files should be a safe method, as no PHP is involved there.

    Best wishes,
    Tobias

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Plugin: WP-Table Reloaded] [table "15" seems to be empty /]’ is closed to new replies.