Advertisement
dassoubarna

UpdateCode

Apr 23rd, 2013
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.06 KB | None | 0 0
  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. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement