Click here to Skip to main content
12,304,761 members (64,352 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: PHP
i want to insert update and delete action performed but some body problem please give me solution and i will forward my code

<?php
 
$objConnect = mysql_connect("localhost","root","") or die(mysql_error());
$objDB = mysql_select_db("prediqnous");
 
if($_POST["hdnCmd"] == "Add")
{
    if(copy($_FILES["fileUpload"]["tmp_name"],"shotdev/".$_FILES["fileUpload"]["name"]))
    {
        $strSQL = "INSERT INTO user1 ";
        $strSQL .="(id,name,description,GallaryName,picture) ";
        $strSQL .="VALUES ";
        $strSQL .="('".$_POST["txtAddid"]."','".$_POST["txtAddname"]."','".$_POST["txtAdddescription"]."','".$_POST["txtGallaryName"]."' ";
        $strSQL .=",'".$_FILES["fileUpload"]["name"]."')";
        $objQuery = mysql_query($strSQL);
            if(!$objQuery)
            {
                echo "error Add[".mysql_error()."]";
            }
    }
 
}
if($_POST["hdnCmd"] == "Update")
{
     if(copy($_FILES["fileUpload"]["tmp_name"],"shotdev/".$_FILES["fileUpload"]["name"]))
     {
 
      $strSQL = "UPDATE user1 SET ";
      $strSQL .="id = '".$_POST["txtEditid"]."' ";
      $strSQL .=",name = '".$_POST["txtEditname"]."' ";
      $strSQL .=",description = '".$_POST["txtEditdescription"]."' ";
      $strSQL .=",GallaryName = '".$_POST["txtEditGalleryName"]."' ";
      $strSQL .=",picture = '".$_FILES["Name"]."' ";
      $strSQL .="WHERE id = '".$_POST["hdnEditid"]."' ";
      $objQuery = mysql_query($strSQL);
      print_r($strSQL);
      }
}
if($_GET["Action"] == "Del")
{
     if(copy($_FILES["fileUpload"]["tmp_name"],"shotdev/".$_FILES["fileUpload"]["name"]))
     {
       $strSQL = "DELETE FROM user1 ";
       $strSQL .="WHERE id = '".$_GET["id"]."' ";
       $objQuery = mysql_query($strSQL);
     }
}
$strSQL = "SELECT * FROM user1";
$objQuery = mysql_query($strSQL) or die(mysql_error());
?>
Posted 28-Apr-13 20:53pm
Comments
Prasad Khandekar 29-Apr-13 2:59am
   
Hello Ashok,

Please provide more information on the problem.
Oso Oluwafemi Ebenezer 29-Apr-13 6:31am
   
What you are asking is unclear!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web01 | 2.8.160530.1 | Last Updated 29 Apr 2013
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100