update values of entire table

For tables connected to a MySQL database, it will output a table of every single value from that table, as text inputs. You can then alter the values of these inputs and re-submit, updating all the values in the database.

get data from db
$sql = mysql_query("SELECT * FROM table");
$count=mysql_num_rows($sql);

start a table
echo '
'; start header of table echo ''; loop through all results while($r=mysql_fetch_object($sql)){ print out table contents and add id into an array and email into an array echo ''; } submit button echo'
  Name Email
'.$r->name.'
'; if form has been submitted, process it if($_POST["Submit"]) { get data from form $name = $_POST['name']; loop through all array items foreach($_POST['id'] as $value) { minus value by 1 since arrays start at 0 $item = $value-1; update table $sql1 = mysql_query("UPDATE table SET email='$email[$item]' WHERE id='$value'") or die(mysql_error()); } redirect user $_SESSION['success'] = 'Updated'; header("location:index.php"); }