title: sql update multiple rows with case in php
body: <p>I am trying to update 11 rows at a time - cricket team (11 players) posted from a form page before, and then I want to update the first table called with these players. (The table includes player, order and team.) </p>
  
  <pre><code>&lt;?php
  session_start();
  
  // Edit this to connect to your database with your username and password
  $db_name="a1467234_cricket"; // Database name 
  $tbl_name="statistics"; // Table name 
  
  // Connect to server and select databse.
  $conn = mysql_connect("mysql17.000webhost.com","*******","*******") or die(mysql_error()); 
  mysql_select_db("$db_name")or die("cannot select DB");
  
  
  $one = $_POST["one"];
  $two = $_POST["two"];
  $three = $_POST["three"];
  $four = $_POST["four"];
  $five = $_POST["five"];
  $six = $_POST["six"];
  $seven = $_POST["seven"];
  $eight = $_POST["eight"];
  $nine = $_POST["nine"];
  $ten = $_POST["ten"];
  $eleven = $_POST["eleven"];
  
  $team = $_POST["team"];
  
  $sql = "UPDATE first
     SET player = (CASE
         WHEN order = 1 ='$team' THEN '$one'
         WHEN order = 2 AND team ='$team' THEN '$two'
         WHEN order = 3 AND team ='$team' THEN '$three'
         WHEN order = 4 AND team ='$team' THEN '$four'
         WHEN order = 5 AND team ='$team' THEN '$five'
         WHEN order = 6 AND team ='$team' THEN '$six'
         WHEN order = 7 AND team ='$team' THEN '$seven'
         WHEN order = 8 AND team ='$team' THEN '$eight'
         WHEN order = 9 AND team ='$team' THEN '$nine'
         WHEN order = 10 AND team ='$team' THEN '$ten'
         WHEN order = 11 AND team ='$team' THEN '$eleven'
         ELSE player
       END
       WHERE order IN (1,2,3,4,5,6,7,8,9,10,11))";
  
  echo "Updated team selection";
  
  mysql_close($conn);
  
  ?&gt;
  </code></pre>
  
  <p>Does anyone know how to get the update script working please? No errors are displayed, and it just doesn't change the database. </p>