简体   繁体   中英

1054 Unknown column 'Array' in 'field list'

Can someone help me with this error, when 1054 Unknown column 'Array' in 'field list'

[27-Oct-2021 09:15:04 Europe/Berlin] PHP Notice:  Array to string conversion in C:\xampp\htdocs\joomla20\plugins\breezingforms_addons\gdata\gdata.php on line 398

The code is:

    $db->setQuery("Update #__breezingforms_addons_gdata Set
            `enabled`  = ".JRequest::getInt('gdata_enabled', 0).",
            ".($accessToken || $reset_accessToken ? "`password` = " . $db->quote($accessToken).',' : '')."
            `spreadsheet_id` = ".$db->quote(trim($gspid) == '' ? "''" : $gspid).",
            `worksheet_id` = ".$db->quote(trim($wid) == '' ? "''" : $wid).",
            `fields` = ".$db->quote($_POST['gdata_fields']).",
            `meta` = ".$db->quote($_POST['gdata_meta'])."
            ".($reset_accessToken ? ",`custom_client_id` = " . $db->quote("34263101371-4rcre0p6r9ehuhoat1d6ls8u84etuanp.apps.googleusercontent.com").', `custom_client_secret` = ' . $db->quote("IDq59sdLo6wC81KCUweDKVf2") : '')."
             Where form_id = " . intval($form_id) . "
        ");
        $db->query();
    }

The 398 line of code is:

    ".($accessToken || $reset_accessToken ? "`password` = " . $db->quote($accessToken).',' : '')."

What I do wrong?

Any help?

I think that I know what is a problem, in this code below:

"`password` = " . $db->quote($accessToken).',' : '')."

$accessToken is an array, not a string and it gives to me an error, and in the table of database in column "password" I can not see records!

But if I made string instead of array example: $accessToken="username->text, password->text"; -> $accessToken="username->text, password->text"; -> I didn't got error and I can see records in my database.

while with array I got error:

$accessToken=array("username" => "text",
"password" => "text",); 

NOW is the question, how to store array type of data in a database? Any help?

Cant store an array, but for example you can store an array, ...

$accessToken = array(
   "username" => "text",
   "password" => "text",
);

like a json, ...

$accessToken = json_encode(array(
   "username" => "text",
   "password" => "text",
));

The result is a string (or a json) and you can store it into a database.

I have one question about PHP coding!

I want to send data to Google sheets, and all works well, I made an app!

I grab data from my app, and send data to sheets, but transferred data isn't sorted well.

The code is below:

foreach($processor->maildata As $data){
    if( in_array($data[_FF_DATA_TITLE].$data[_FF_DATA_ID], $bffields) ){
        $rowData[] = [$data[_FF_DATA_VALUE]];
    }
}

I getting data as $rowData[]=[["test"],["test"],["test"]] but they should be sortet as $rowData[]=[["test","test","test"]] .

I always get data in sheets one below the other in A1 row, but they should be sorted in sheets row by row (A,B,C..)

I hope I explained it well!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM