3

I've made a table with the following fields:

`id` type:INT,
`id_list`type:TEXT,
`name`type:VARCHAR(255).

id is my primary key.

From phpmyadmin 3.4.11.1deb2, I inserted a row:

(`null`, `'["1","2","3","4"]'`, `'TEST'`)

and it successfully saves to the table.

However, when I try to update the id_list field, instead of a text-field containing ["1","2","3","4"], I see a drop-down-list with each row equivalent to the text array that I stored.

Is this by design or a bug in the way that phpmyadmin is renders the resulting text?

enter image description here

I had to use a different table as an example, but notice the drop-down-list instead of a text-field.

gen_Eric
  • 223,194
  • 41
  • 299
  • 337
nubleet
  • 33
  • 5
  • 1
    now you got the score try adding the image, bcoz i tested works fine with mine – Deepika Janiyani Jan 13 '14 at 09:03
  • You are using an old version of phpMyAdmin, maybe try to update? – gen_Eric Jan 13 '14 at 17:49
  • @Anamika I created a new table and inserted my example data and I too can make changes with a textfield, STRANGE. I dynamically added the information in the image using a AJAX to PHP PDO script. The field is an array prepared with JSON.stringify(). $q = "INSERT INTO `schedules` (id, customer_id, employees, time_start, time_end) VALUES ('', :customer_id, :employees, :time_start, :time_end)"; $do = $db->prepare($q); – nubleet Jan 13 '14 at 17:53
  • I just noticed that the customer_id field in the image is also experiencing the same problem. Shouldn't an INT type field be a text field and not a drop-down? – nubleet Jan 13 '14 at 18:56
  • 1
    Could it be there's some links / relational data in your `pmadb` which tells phpmyadmin the fields refer to other fields/rows/records? That'd do it afaik.... At least for the `TEXT` one, the `customer_id` could be a plain `FOREIGN KEY` perhaps. – Wrikken Jan 13 '14 at 21:47
  • may be problem is with the quotes, you are using "" in values and in your insert query also, and may be because of that you are facing issues. please add full code and echo the query you are working on – Deepika Janiyani Jan 14 '14 at 10:57
  • Thanks Wrikken, Anamika, it appears there is a relation set to both the customer_id and employees field. Thank you for your input. – nubleet Jan 14 '14 at 19:45

1 Answers1

1

You probably have some relations between tables through these fields, as @Wrikken said in comments to your question. I've used a pretty similar table structure, and also added one more table to reproduce the assumption I'm talking about:

-- First table, similar to problem table

CREATE TABLE bars ( id int(11), list text, bar varchar(255), PRIMARY KEY (id) );

INSERT INTO bars (id, list, bar) VALUES (1, '["1","2","3","4"]', 'TEST');

-- Second table, to reproduce the assumtion

CREATE TABLE foos ( id int(11), foo varchar(255), PRIMARY KEY (id) );

INSERT INTO foos (id, foo) VALUES (1, 'foo1'), (2, 'foo2'), (3, 'foo3'), (4, 'foo4'), (5, 'foo5'), (6, 'foo6');

From scratch everything works fine as expected, i can edit TEXT field as text:

enter image description here

To reproduce 'dropdown' effect I've opened a problem bars table (with TEXT field) relations:

enter image description here

and have added a reference to foos, a table with possible ids, that are stored in list TEXT field as array:

enter image description here

Now when editing a record i have a dropdown instead of textarea for TEXT list field

enter image description here

So, try to check whether you have your TEXT field involved in any relations

sorry, no rep to comment yet, so giving a complete answer that may not be a solution at all

Michael Radionov
  • 12,859
  • 1
  • 55
  • 72
  • that appears to be it! Sadly, I am picking up this project from someone else. I've never dealt with field relations before, and I thank you and the community for the help. – nubleet Jan 14 '14 at 19:43