Want more features on Pastebin? Sign Up, it's FREE!
Guest

UpdateCode

By: dassoubarna on Apr 23rd, 2013  |  syntax: PHP  |  size: 1.06 KB  |  views: 27  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. <?php
  2.         $value = $_GET['value'];
  3.         $id = $_GET['rowId'] ;
  4.         $columnId = $_GET['columnId'] ;
  5.         if ($columnId=="state"){
  6.         $value=$state;
  7.         } elseif ($columnId=="city"){
  8.         $value=$city;
  9.         } elseif ($columnId=="tehsil"){
  10.         $value=$tehsil;
  11.         } elseif ($columnId=="village"){
  12.         $value=$village;
  13.         } elseif ($columnId=="name"){
  14.         $value=$name;
  15.         } elseif ($columnId=="ward"){
  16.         $value=$ward;
  17.         } elseif ($columnId=="address"){
  18.         $value=$address;
  19.         } elseif ($columnId=="description"){
  20.         $value=$description;
  21.         } elseif ($columnId=="mobile"){
  22.         $value=$mobile;
  23.         }
  24.         //Always accepts update(return posted value)
  25.         mysql_connect("localhost","xxxxxxx","xxxxxxxx") or die("Error: ".mysqlerror());
  26.         mysql_select_db("xxxxxxxxxxxxx");
  27.         $sql = "UPDATE `table`
  28.         SET `state` = '$state',
  29.                 `city` = '$city',
  30.                 `tehsil` = '$tehsil',
  31.                 `village` = '$village',
  32.                 `name` = '$name',
  33.                 `ward` = '$ward',
  34.                 `address` = '$address',
  35.                 `description` = '$description',
  36.                 `mobile` = '$mobile'
  37.         WHERE `id` = '$id'";
  38.         mysql_query($sql) or die ("Error: ".mysql_error());
  39.         echo "Database updated.";
  40. ?>
clone this paste RAW Paste Data