Results 1 to 2 of 2

Thread: Delete Record

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jul 2004
    Posts
    1,202

    Delete Record

    How would i go about deleteing a record from my database, i use this html form to send the data.?

    <html>
    <head>
    <title>Request</title>
    <link rel="stylesheet" type="text/css" href="style.css">
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>


    <form method="post" action="process.php">
    <td align="center" valign="top">
    <?php if(isset($_GET["ip"]) == "sent") { echo "<font color=\"red\">Ip has been added to band list, thank you.</font>"; } else {}?>
    <br>
    <table width="40%" border="0" align="center" cellpadding="2" cellspacing="2" bordercolor="#000000">
    <tr align="left" valign="top">
    <td width="20%"> IP:</td>
    <td width="80%"> <input name="ip" type="text" id="ip"></td>
    </tr>
    <tr align="left" valign="top">
    <td>Reason:</td>
    <td> <textarea name="Reason" cols="25" rows="4" id="Reason"></textarea></td>
    </tr>
    <tr align="left" valign="top">
    <td>&nbsp;</td>
    <td> <input type="submit" name="Submit" value="Submit to server">
    </td>
    </tr>
    </table> </td>
    </tr>
    </table>
    <div align="center"><br>
    <font size="-2">*Please do not abuse the request box. Your IP will be logged
    for security purposes. </font></div>
    </form>
    </body>
    </html>
    Process.php code.

    PHP Code:
    <?php
    $ip 
    $_POST["ip"];
    $Reason $_POST["Reason"];

    if(
    $ip == "" OR $Reason == ""){
        echo 
    "Your name or message was blank! Please go back and fix this";
        die();
    } else {}

    include(
    "config.php");


        
    mysql_connect("$host""$username""$password");
        
    mysql_select_db($db) or die(mysql_error());

    mysql_query("INSERT INTO `ip` ( `ip` , `Reason`  ) VALUES ( '$ip' , '$Reason')")
    or die (
    "Could not insert into database.");

    header("Location: add.php?ip=sent");

    ?>
    Last edited by Jamie_Garland; Oct 14th, 2008 at 07:50 AM.
    come back and mark your original post as resoved if your problem is fixed

    Jamie Garland

  2. #2
    WiggleWiggle dclamp's Avatar
    Join Date
    Aug 2006
    Posts
    3,527

    Re: Delete Record

    like this:

    PHP Code:
    $ip '127.0.0.1';

    mysql_query("DELETE FROM `ip` WHERE ip='{$ip}'"); 
    My usual boring signature: Something

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width