+ Reply to Thread
Results 1 to 9 of 9




  

Thread: Help required in delete option

      
  1. #1
    Jedi Master realistic is on a distinguished road
    Join Date
    November 5, 2008
    Location
    London
    Posts
    162
    Rep Power
    4
    Feedback Score
    0

    Question Help required in delete option

    The delete option is not working in table. Please help me

    here is my php script


    <?php
    $link = mysql_connect("localhost", "root", "")
    or die("Could not connect: " . mysql_error());
    mysql_select_db('taskmangment', $link)
    or die(mysql_error());
    ?>
    <?php
    switch ($_GET['action'])
    {
    case "remove":

    $sql = "DELETE FROM AddJob WHERE note_id='".$_GET['id']."'";
    break;
    }

    if (isset($sql) && !empty($sql)) {
    echo "<!--" . $sql . "-->";
    $result = mysql_query($sql)
    or die("Invalid query: " . mysql_error());
    }
    ?>

    <html>
    <head>
    <title>JobNotes</title>
    <style type="text/css">
    TD{color:#353535;font-family:Verdana, Arial, Helvetica, sans-serif}
    TH{color:#FFFFFF;font-family:Verdana, Arial, Helvetica,
    sans-serif;background-color:#336699;font-size:10pt}
    body,td {
    border-left:#FFF;
    font-size: 8pt;
    }
    a:link {
    color: #00F;
    text-decoration: none;
    }
    a:visited {
    text-decoration: none;
    color: #00F;
    }
    a:hover {
    text-decoration: none;
    color: #600;
    }
    a:active {
    text-decoration: none;
    color: #00F;
    }
    </style>
    <script>
    function deleteAlert(id){
    var conBox = confirm("Are you sure you want to delete");
    if(conBox){
    location.href="JobNotes.php?note_id="+ id + "&action=remove";
    }else{
    return;
    }
    }
    </script>
    <script type="text/javascript">
    function open_win()
    {
    window.open("New_Notes.php?action=add&id=",'','wid th=480,height=200,left=450,top=150');
    }

    </script>
    <script type="text/javascript">
    function edit_win(id)
    {
    var url="New_Notes.php?note_id="+id+"&action=edit";

    window.open(url,'','width=480,height=200,left=450, top=150,resizable=yes');
    }

    </script>

    <script type="text/javascript">
    function Att_win(id)
    {
    var url="AddNew1.php?note_id="+id+"&action=add1";

    window.open(url,'','width=480,height=200,left=450, top=150,resizable=yes');
    }

    </script>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></head>
    <body>
    <table border="0" width="100%" cellspacing="1" cellpadding="3"
    bgcolor="#353535" >
    <tr>
    <th bgcolor="#FFFFFF" align="center">
    JobNotes
    </th>
    <th colspan="2" align="left" bgcolor="#FFFFFF"><input type='button'
    value="AddNew" onClick="open_win()"></th>
    </tr>
    <?php
    $sql = "SELECT * FROM AddJob ORDER BY note_id";
    $result = mysql_query($sql)
    or die("Invalid query: " . mysql_error());
    while ($row = mysql_fetch_array($result)) {
    ?>
    <tr>
    <td bgcolor="#FFFFFF" width="77%">
    Asigned to:&nbsp;<?php echo $row['Ass']; ?>&nbsp;&nbsp;|&nbsp;&nbsp;Deliverd Date(M/d/Y):&nbsp;
    <?php echo $row['Ddate']; ?>&nbsp;&nbsp;|&nbsp;&nbsp;Verified By:
    </td>
    <td width="13%" rowspan="3" align="right" valign="top" bgcolor="#FFFFFF"><?php echo $row['date_time']; ?></td>
    <td width="10%" rowspan="3" align="right" valign="top" bgcolor="#FFFFFF">
    <a href="javascript:edit_win(<?php echo $row['note_id']?>)"><img src="Images/edit.gif" width="16"
    height="16" hspace="0" vspace="0" border="0"></a>
    <a href="javascript:deleteAlert('id')">Remove</a>
    </td>
    </tr>
    <tr>
    <td bgcolor="#FFFFFF"><?php echo nl2br($row['note']); ?></td>
    </tr>
    <tr>
    <td bgcolor="#FFFFFF"><a href="javascript:Att_win(<?php echo $row['note_id']?>)">Attchments</a></td>
    </tr>
    <?php
    }
    ?>

    </table>
    </body>
    </html>

  2. #2
    Jedi Master ChrisMac is on a distinguished road
    Join Date
    November 26, 2009
    Posts
    29
    Rep Power
    3
    Feedback Score
    0

    Default Re: Help required in delete option

    add

    PHP Code:
    error_reporting(E_ALL
    to the top of your script and see if you are getting any errors?

    Provide live help to your website visitors
    Download Live Chat Software now
    Free 30 days trial

  3. #3
    Jedi Master sandeep Kumar is on a distinguished road
    Join Date
    June 24, 2010
    Location
    India
    Posts
    35
    Rep Power
    2
    Feedback Score
    0

    Default Re: Help required in delete option

    here i'll change the deletion line see them and just try

    Code:
    $sql = mysql_query("DELETE FROM AddJob WHERE note_id='$_GET[id]' ",$connect);

  4. #4
    Jedi Master waynewex is on a distinguished road
    Join Date
    August 16, 2010
    Posts
    25
    Rep Power
    2
    Feedback Score
    0

    Default Re: Help required in delete option

    You should be using mysql_real_escape_string on external variables ($_GET, $_POST) before inserting them into queries.

  5. #5
    Jedi Master sandeep Kumar is on a distinguished road
    Join Date
    June 24, 2010
    Location
    India
    Posts
    35
    Rep Power
    2
    Feedback Score
    0

    Default Re: Help required in delete option

    $sql = "DELETE FROM AddJob WHERE note_id='".$_GET['id']."'";

    you Just replace it that command

    <?php
    .
    .
    .

    $id=$_GET['id'];

    $query = mysql_query("DELETE FROM AddJob WHERE note_id= '$id' ",$connect);

    .
    .
    .

    ?>

  6. #6
    Grand Masters simplyamazing12 will become famous soon enoughsimplyamazing12 will become famous soon enough
    Join Date
    May 6, 2010
    Posts
    593
    Rep Power
    3
    Feedback Score
    0

    Default Re: Help required in delete option

    You need to add the DELETE code and assign the new job.
    Dreamweaver can probably fix this up in a jippy for you.
    My Business: Chi Chi Floral [link soon!]

    Web hosting provided by: Myhosting.com

  7. #7
    Jedi Master achilles is on a distinguished road
    Join Date
    November 1, 2010
    Posts
    25
    Rep Power
    2
    Feedback Score
    0

    Default Re: Help required in delete option

    you should avoid using keywords that is using by SQL and php

  8. #8
    Jedi Master infoman66 is on a distinguished road
    Join Date
    September 5, 2010
    Posts
    44
    Rep Power
    2
    Feedback Score
    0

    Default Re: Help required in delete option

    Instead:
    Code:
    <?php 
    switch ($_GET['action']) 
    {
    case "remove":
    
    $sql = "DELETE FROM AddJob WHERE note_id='".$_GET['id']."'";
    break;
    }
    Firs get value, than delete:
    Code:
    <?php 
    switch ($_GET['action']) 
    {
    case "remove":
    $getId = $_GET['id'];
    $sql = "DELETE FROM AddJob WHERE note_id=$getId";
    break;
    }
    If you are in the Palm Beach, Boca Raton, Fort Lauderdale or Delray Beach areas and are in need of high quality, professional limousine services, Palm Beach Limo or Fort Lauderdale limo
    is eager to serve you...

  9. #9
    I'm New! hostingguru is on a distinguished road
    Join Date
    January 27, 2011
    Posts
    13
    Rep Power
    2
    Feedback Score
    0

    Default Re: Help required in delete option

    hi everyone keep sharing with us.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Similar Threads

  1. Match Type Option In Google Adwords Keyword Tool
    By seodragon in forum SEO Forum
    Replies: 7
    Last Post: Jun 29th, 2009, 1:32 am
  2. Retweet option related help required
    By Jani in forum Forum Management
    Replies: 3
    Last Post: May 18th, 2009, 6:56 pm
  3. Creating A Search Option
    By stefanie in forum HTML & Website Design
    Replies: 5
    Last Post: Jul 27th, 2007, 4:46 am

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
WebTalkForums
WebTalkForums
Recent Forum Threads