The problem is most likely that I have been looking at it for too long and missed the obvious. I know I can make multiple fields in the database and work with it that way, but I'm sure an array is the proper solution.
We have a form (and how many of our tales start off like that? Bet it
beats "once upon a time"). which gathers data for work orders. And we
want to assign multiple people to a particular job.
<td> <input TYPE="checkbox" NAME="workers[ ]" VALUE="82">Worker0
<input TYPE="checkbox" NAME="workers[ ]" VALUE="83">Worker1
<input TYPE="checkbox" NAME="workers[ ]" VALUE="84">Worker2
<input TYPE="checkbox" NAME="workers[ ]" VALUE="85">Worker3
</td><tr>
With the values being the employee/student id number. The values for
workers[ ] are passed along with the rest of the input from the form via
a post statement.
When I get to processing page I checked to see if there was data via
some echo's and it does indeed seem as though the data made it through.
echo "$workers[0] <br>";
echo "$workers[1] <br>";
(each returns the values expected)
In the dataset (postgresql) I defined workers as integer [ ] so it
should be able to receive the data and it should be an array of
integers.
My update statement is as follows:
$update_now="UPDATE work_orders SET
add_info2='$add_info2',
status='$status',
workers =$workers,
when_assigned='$now'
where work_order_id='$work_id'
";
which gives the following error message.
UPDATE work_orders SET add_info2='fagsh', status='Working', workers
=Array, when_assigned='1069188482' where work_order_id='1'
[nativecode=ERROR: Attribute "array" not found ].
When I try imploding $workers, converting it to a string and putting
that into workers it tells me the following.
UPDATE work_orders SET add_info2='qwer', status='Working', workers =83,
when_assigned='1069188871' where work_order_id='1' [nativecode=ERROR:
column "workers" is of type integer[] but expression is of type integer
You will need to rewrite or cast the expression ]
Any and all advice/help much appreciated.
--
Dr. Roy F. Cabaniss
Associate Professor of Marketing
University of Arkansas Monticello
http://cabanisspc.uamont.edu
signature.asc
Description: This is a digitally signed message part

