arrays in to mysql

i want to create a page where i can change values from ‘new members’ to ‘paid’ in bulk.

i created a form where you put in the ID number of the person then a drop down menu of the type of status the person is…

<form action="scripts/status.php"
      method="post">

<table summary="edit_tables"
       border="1">
<tr>
<td><b>ID Number:</b></td>

<td><input type="text"
       name="ID1"
       size="5" />
</td>

<td>
<select name="status1" value ="">
<option value='pending'>
pending
</option>

<option value='paid'>
paid
</option>

<option value='waiting'>
waiting
</option>

<option value='new'>
new
</option></select>
</tr>
<tr>
<td><b>ID Number:</b></td>

<td><input type="text"
       name="ID2"
       size="5" />
</td>

<td>
<select name="status2" value ="">
<option value='pending'>
pending
</option>

<option value='paid'>
paid
</option>

<option value='waiting'>
waiting
</option>

<option value='new'>
new
</option>
</select>
</tr>
<tr>
<td><b>ID Number:</b></td>

<td><input type="text"
       name="ID3"
       size="5" />
</td>

<td><select name="status3" value ="">
<option value='pending'>
pending
</option>

<option value='paid'>
paid
</option>

<option value='waiting'>
waiting
</option>

<option value='new'>
new
</option>
</select>
</tr>
<tr>
<td><input type="submit"value="Change Status" /></td>
</tr>
</table> 

now i want to apply these values to variables and upload them to the mysql database using the update set query…

<?php 
include 'dbconfig.php';
 
 $id_array[0] = $_POST["ID1"]; 
 $id_array[1] = $_POST["ID2"]; 
 $id_array[2] = $_POST["ID3"]; 
 $status_array[0] = $_POST["status1"];
 $status_array[1] = $_POST["status2"];
 $status_array[2] = $_POST["status3"];

but unsure what to do next, i thinking of using the…

mysql_query ("update members set PaidStatus = $status_array where id = $id_array") 
or die(mysql_error()); 

function but i do not how to combine both status and ID array into one then execute them all through a query… any help?

You could sort the values of the form by their status and do something like this:

UPDATE members SET PaidStatus = $status WHERE id IN ($id_array)
Sponsor our Newsletter | Privacy Policy | Terms of Service