Error: 1054 - Unknown column 'Array' in 'field list'...

Fredolino 28 Dec, 2015
Hi,
Under "Designer" I have a "multi-field" created.
This includes a
"File Field" and a "Costum" (screen)

In "Costum" is the code:
 <span class="btn btn-danger btn-xs multiplier-remove-button" style="display:none;"><i class="fa fa-times fa-lg"></i></span> 


Under "Setup" is a "Files Upload" -Action
File Config:
dataup: pdf
Photo: jpg

Array Fields: dataup

Under "Setup"
there is still a Costum Code:
<? php
pr ($ _ FILES);

With the File Upload Button I can eg. Select 2 PDF files at the same time, then what looks (screen1)
When I press the submit button at the end, I actually thought that the 2 PDF files sent with and file names are entered into the database.

F.
GreyHead 29 Dec, 2015
Hi Fredolino,

If you use a Multiplier then the data returned is in an array and you can't save an array directly to a database table.

Either you need to convert the data to a string - a comma separated string usually, or possibly JSON encoded. Or - probably better in most cases, you save the array data to a second table with each item in a new record linked to the main record for this submission.

Bob
Fredolino 29 Dec, 2015
Hi Bob,

I believe that I have come a little step further.
As it stands, I can now select multiple files and send (screen1).
But the problem with the entries in the database still exists, because the files are not stored.
I have now set up so that up to 5 files can be uploaded.
Maybe that's why I do not need new table? However, I now do not know how I "upload" the files, separated by commas can enter into the DB column.
In the "Files Upload" -Action I have Array Fields this:
dataup [0], dataup [1], dataup [2], dataup [3], dataup [4], dataup [5]

F.
Fredolino 29 Dec, 2015
Hi,
I can also use this code for creating a new table for the PDF files in a "Costum Code" in the setup so that I can do in one form all together? And how is the table associated with the table "epg0c_js_job_resume1"?

header("Content-Type: text/html; charset=utf-8"); 
error_reporting(-1); 

//Testarray 
$a = dataup("pdf1",2,"pdf2",true); 
var_dump($a); echo "<br>"; 

$js = json_encode($a); 
var_dump($js); echo "<br>"; 

//SQlite im Speicher erstellen 
$db = new PDO("sqlite::memory:"); 
$sql = "CREATE TABLE epg0c_js_job_resume1_live (id INTEGER PRIMARY KEY  NOT NULL , json TEXT NOT NULL  DEFAULT '')"; 
$db ->exec($sql); 

//json einfügen 
$sql = "INSERT INTO epg0c_js_job_resume1_live (id, json) VALUES (?,?)"; 
$stmt = $db->prepare($sql); //SQL_statment vorbereiten 
$stmt -> execute(dataup(0,$js)); 
$count = $stmt->rowCount();  //Anzahl der Zeilen welche eingefügt wurden 

//json auslesen 
$stmt = $db -> query("SELECT json FROM epg0c_js_job_resume1_live WHERE id = 0"); 
$row = $stmt->fetch(PDO::FETCH_ASSOC); 

//json-string abholen und decodieren 
$jsonString = $row['json']; 
$adb = json_decode($jsonString,true); 
// 
var_dump($adb); echo "<br>"; 
Fredolino 31 Dec, 2015
Hi,

I still do not solve the problem with the multiple selection of the PDF files I können.Wenn these files store in a second table, then I do not know how I still can do it a form that. The tables must be somehow linked yes.

F.
GreyHead 31 Dec, 2015
Hi Fredolino,

If you need to create a new table you can do that in PHPMyAdmin, or, if you like, with the Create Table icon in the Forms Manager.

If you post the DeBugger output showing the file data we can look at how to save that,

Bob
Fredolino 31 Dec, 2015
Hi Bob,
This sounds simple :-)
I'm creating a new table with the PHPMyAdmin and then I create a table in the form of CF Manager 5. As far as I understand anything.
The table is the name "epg0c_js_job_lebenslauf" have and consists of 2 columns
id | lebenslauf
Then this table "epg0c_js_job_resume1" must have CF5 / CC5 with my other table, where all the other data in it are connected, so that the links under "view" are also displayed.
Best regards
F.
PS. It goes on tomorrow. I'm going once drinking single malt. :-)
GreyHead 01 Jan, 2016
Hi Fredolino,

Your table probably needs at least three columns (and maybe more). The third column will link these entries with the records in your main table.

Bob
Fredolino 01 Jan, 2016
Hi Bob,
I wish a healthy, prosperous New Year.
I have created the table with phpMyAdmin (screen)

F.
This topic is locked and no more replies can be posted.