foreach PHP的问题

<?php
include('../../../config.php');

 for ($i=0;$i<count($_POST['theID']);$i++) {

  $id = $_POST['theID'][$i];

  mysql_query("UPDATE ava_users SET about = '$id' WHERE id = '$id'");

 } 
?>

I have a select multiple option form that has an $_POST output of: 2,3 for an example. The 2,3 are ID's I have selected for user's IDs.

Id like to use ID's 2,3 and add them into a MySQL_query() such as,

MySQL_query("INSERT INTO... WHERE ID = 2);

MySQL_query("INSERT INTO... WHERE ID = 3);

etc..

I have tried this snippet code and seems to be not working...

Can anyone help?

</div>

As I underatand, the POST string is a list of ids, separated by commas. You need to get clean array of ids, not a string. For that purpose, use

$ids = explode(",", $_POST["theID"]);

Then, iterate through that array like you did before:

for ($i=0;$i<count($ids);$i++)
{ 
    $id = $ids[$i];
    mysql_query("UPDATE ava_users SET about = '$id' WHERE id = '$id'"); 
}