Note that there are some explanatory texts on larger screens.

plurals
  1. POLAMP attendance system
    primarykey
    data
    text
    <p>i just cant get the right approach to this problem, i have two arrays . first array $attendance which has the following keys and values</p> <pre><code>Array ( [attendance] =&gt; Array ( [1] =&gt; 1 [2] =&gt; 1 [3] =&gt; 0 [4] =&gt; 1 [5] =&gt; 1 [6] =&gt; 0 [7] =&gt; 0 ) </code></pre> <p>This is coming from a checkbox if checked value is 1 else value is 0 The second array is $remark</p> <pre><code>[remark] =&gt; Array ( [1] =&gt; [2] =&gt; [3] =&gt; 'sick' [4] =&gt; [5] =&gt; [6] =&gt; 'leave' [7] =&gt; 'On assignment' ) </code></pre> <p>Now this is what the key 1- 7 stands for, the script is for employee's attendance the key 1-7 is the employeeID in the employee table in my database.</p> <p>Now what i want to achieve is concatenate the array in such a way to look like this</p> <pre><code>Array ( [0] =&gt; Array ( [employeeID] =&gt; 7 [attendance] =&gt; 0 [remark] =&gt; 'On assignment' ) [1] =&gt; Array ( [employeeID] =&gt; 6 [attendance] =&gt; 0 [remark] =&gt; 'leave' ) [2] =&gt; Array ( [employeeID] =&gt; 5 [attendance] =&gt; 1 [remark] =&gt; ) //and so on ) </code></pre> <p>I am using Codeigniter If i am able to concatenate it i will also love to know how i will insert the multiple data into the employee table which looks like this, </p> <pre><code>employee's table employeeID | date | status | remarks </code></pre> <p>the date i planned using CURDATE() then status will hold either 0 or 1 from attendance <strong>Again</strong>: the keys from 1- 7 both on the remark and attendance's array is the employeeID</p> <p>update!! this is what i tried but did not work.</p> <pre><code>$att = $_POST['attendance']; $remarks = $_POST['remark']; foreach($att as $employee_id=&gt;$status) { $x=0; $employee[$x]['employee_id']=$employee_id; $employee[$x]['status']=$status; foreach($remarks as $employee_id=&gt;$remark) { $employee[$x]['remark']=$remark; $x++; } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload