I use MampPro to setup my sites on the local server... all well and good. So, every time I fire it up I get the upgrade nag... so, I figure its time, and hit the upgrade... and it does its thing.

BOOM, every database I had there - gone! GRR! Dang! - Fortunately I was proactive and copied all of the previously ( the DB dir Mamp ). The internet tells me to simply put them back in the dir and restart - which I do....

Now PhpMyAdmin "sees" the DB's but does not have index's for any of them - I can see the column structure, but they have this yellow/red error for anything I try to open.

Here's an image of what its doing -- https://i.stack.imgur.com/xi3yM.png
Click Here

Does anyone know how to repair this - all my work is gone... I mean literally, everything!

Maybe there's some form of sql insert that will look at the columns and add the table index - I don't know SQL is not my baliwyck

Recommended Answers

All 7 Replies

Could the #1305 be the line number of the PHP code we need to examine?

I see the file "TableStructureController.php" mentioned but did you check it out? I can't since, not shared here.

https://www.google.com/search?q=mamp+upgrade+%22illegal+string+offset%22&gl=US seems to point to changes in PHP and strictness. My advice is to read a few of those then look at the php code in question.

This is the content of that file

<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */

/**
 * Holds the PMA\TableChartController
 *
 * @package PMA
 */

namespace PMA\libraries\controllers\table;

use PMA\libraries\controllers\TableController;
use PMA\libraries\Message;
use PMA\libraries\Response;
use PMA\libraries\Template;
use PMA\libraries\Util;

/**
 * Handles table related logic
 *
 * @package PhpMyAdmin
 */
class TableChartController extends TableController
{

    /**
     * @var string $sql_query
     */
    protected $sql_query;

    /**
     * @var string $url_query
     */
    protected $url_query;

    /**
     * @var array $cfg
     */
    protected $cfg;

    /**
     * Constructor
     *
     * @param string $sql_query Query
     * @param string $url_query Query URL
     * @param array  $cfg       Configuration
     */
    public function __construct($sql_query, $url_query, $cfg)
    {
        parent::__construct();

        $this->sql_query = $sql_query;
        $this->url_query = $url_query;
        $this->cfg = $cfg;
    }

    /**
     * Execute the query and return the result
     *
     * @return void
     */
    public function indexAction()
    {
        $response = Response::getInstance();
        if ($response->isAjax()
            && isset($_REQUEST['pos'])
            && isset($_REQUEST['session_max_rows'])
        ) {
            $this->ajaxAction();
            return;
        }

        // Throw error if no sql query is set
        if (!isset($this->sql_query) || $this->sql_query == '') {
            $this->response->setRequestStatus(false);
            $this->response->addHTML(
                Message::error(__('No SQL query was set to fetch data.'))
            );
            return;
        }

        $this->response->getHeader()->getScripts()->addFiles(
            array(
                'chart.js',
                'tbl_chart.js',
                'jqplot/jquery.jqplot.js',
                'jqplot/plugins/jqplot.barRenderer.js',
                'jqplot/plugins/jqplot.canvasAxisLabelRenderer.js',
                'jqplot/plugins/jqplot.canvasTextRenderer.js',
                'jqplot/plugins/jqplot.categoryAxisRenderer.js',
                'jqplot/plugins/jqplot.dateAxisRenderer.js',
                'jqplot/plugins/jqplot.pointLabels.js',
                'jqplot/plugins/jqplot.pieRenderer.js',
                'jqplot/plugins/jqplot.highlighter.js'
            )
        );

        /**
         * Extract values for common work
         * @todo Extract common files
         */
        $db = &$this->db;
        $table = &$this->table;
        $url_params = array();

        /**
         * Runs common work
         */
        if (strlen($this->table) > 0) {
            $url_params['goto'] = Util::getScriptNameForOption(
                $this->cfg['DefaultTabTable'], 'table'
            );
            $url_params['back'] = 'tbl_sql.php';
            include 'libraries/tbl_common.inc.php';
            include 'libraries/tbl_info.inc.php';
        } elseif (strlen($this->db) > 0) {
            $url_params['goto'] = Util::getScriptNameForOption(
                $this->cfg['DefaultTabDatabase'], 'database'
            );
            $url_params['back'] = 'sql.php';
            include 'libraries/db_common.inc.php';
        } else {
            $url_params['goto'] = Util::getScriptNameForOption(
                $this->cfg['DefaultTabServer'], 'server'
            );
            $url_params['back'] = 'sql.php';
            include 'libraries/server_common.inc.php';
        }

        $data = array();

        $result = $this->dbi->tryQuery($this->sql_query);
        $fields_meta = $this->dbi->getFieldsMeta($result);
        while ($row = $this->dbi->fetchAssoc($result)) {
            $data[] = $row;
        }

        $keys = array_keys($data[0]);

        $numeric_types = array('int', 'real');
        $numeric_column_count = 0;
        foreach ($keys as $idx => $key) {
            if (in_array($fields_meta[$idx]->type, $numeric_types)) {
                $numeric_column_count++;
            }
        }

        if ($numeric_column_count == 0) {
            $this->response->setRequestStatus(false);
            $this->response->addJSON(
                'message',
                __('No numeric columns present in the table to plot.')
            );
            return;
        }

        $url_params['db'] = $this->db;
        $url_params['reload'] = 1;

        /**
         * Displays the page
         */
        $this->response->addHTML(
            Template::get('table/chart/tbl_chart')->render(
                array(
                    'url_query' => $this->url_query,
                    'url_params' => $url_params,
                    'keys' => $keys,
                    'fields_meta' => $fields_meta,
                    'numeric_types' => $numeric_types,
                    'numeric_column_count' => $numeric_column_count,
                    'sql_query' => $this->sql_query
                )
            )
        );
    }

    /**
     * Handle ajax request
     *
     * @return void
     */
    public function ajaxAction()
    {
        /**
         * Extract values for common work
         * @todo Extract common files
         */
        $db = &$this->db;
        $table = &$this->table;

        if (strlen($this->table) > 0 && strlen($this->db) > 0) {
            include './libraries/tbl_common.inc.php';
        }

        $sql_with_limit = sprintf(
            'SELECT * FROM(%s) AS `temp_res` LIMIT %s, %s',
            $this->sql_query,
            $_REQUEST['pos'],
            $_REQUEST['session_max_rows']
        );
        $data = array();
        $result = $this->dbi->tryQuery($sql_with_limit);
        while ($row = $this->dbi->fetchAssoc($result)) {
            $data[] = $row;
        }

        if (empty($data)) {
            $this->response->setRequestStatus(false);
            $this->response->addJSON('message', __('No data to display'));
            return;
        }
        $sanitized_data = array();

        foreach ($data as $data_row_number => $data_row) {
            $tmp_row = array();
            foreach ($data_row as $data_column => $data_value) {
                $tmp_row[htmlspecialchars($data_column)] = htmlspecialchars(
                    $data_value
                );
            }
            $sanitized_data[] = $tmp_row;
        }
        $this->response->setRequestStatus(true);
        $this->response->addJSON('message', null);
        $this->response->addJSON('chartData', json_encode($sanitized_data));
    }
}

Mine shows 5.6

Do I need to upgrade again

Now I wonder if I have corrupted them too much

At this point and with the story so far plus you did not answer my question I think it's best you ask (edited) MAMPRO directly. My bet is you didn't follow the directions, didn't know there were directions or "other."

https://www.mamp.info/en/support/ should be your next stop.

I did upgrade using the button - I did contact MAMP support - The upgrade created a copy of the orig ( this is what I was using )

However, it created a 5.6 version and not a 5.7

So I did follow all the steps.....

And I did upgrade the DB as was told to from the beginning...

Then it's a bum system that they have hung you out to dry. Ask for a refund and roll back to what worked until you find a new system.

The error is discussed on the web but it means you have to dive into the PHP code to find the error and fix it. But that's not why you are using MAMP. I take it you are not ready to dig into their product to fix it. I know I can't since I don't run MAMP and even if I did, this error would have me camping out at MAMP's support.

commented: vb +0
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.