Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

Hello to everyone in this fantastic club , Im amira from morocco , iam new to the forum ,all i need a little help here ,When a was creating a little code in php/mysql i wanted to know how to built a php form to delete an item from database and thank's alot <3

the first code is index.php the goal of the script is to gather information about the Visitor's of my wesite because i have a war with Leet hackers who want to deface my website and im a new is this domain ,

<?php

    $getting_ips = mysql_query("SELECT * FROM ip_capture_module");
    if ($getting_ips) {
        while ($row = mysql_fetch_array($getting_ips)) {
    ?>
    <tr>
        <td><?php echo $row['id']; ?></td>
        <td><strong><? echo $row['country']; ?></strong></td>
                                <td><?php echo $row['browser']; ?></td>

        <td><a href="http://<?php echo $row['ipaddr']; ?>"><?php echo $row['ipaddr']; ?></a></td>
                    <td><?php echo $row['method']; ?></td>
        <td><strong><?php echo $row['sploit'];  ?></strong></td>
        <td><?php echo $row['date']; ?></td>
        <td><a href="delete.php">delete</a></td>
    </tr>

    <?php
// The Second Code is capture.php

------------------------------------------------------------------------------------------

   ...
        ....
 mysql_query("INSERT INTO ip_capture_module(country,browser,ipaddr,method,date) VALUES(
            '$country_name',
            '$browser',
            '$ip',
            '$method',
            CURRENT_TIMESTAMP())") or die ("<br>Error in inserting in IP: ".mysql_error()."<br>");
share|improve this question
    
do you have some code that you have already written for this application? –  Maximus2012 Jul 17 '13 at 22:22
1  
Welcome to StackOverflow! You have to be much more specific then that. What parts are you having problems with? Edit your question and post your current code so that we can see your effort. –  peterm Jul 17 '13 at 22:22
    
You might want to start here: us1.php.net/manual/en/mysqli.query.php Once you have tried a few things, try posting what you have so we can give more specific direction –  Moch Daear Jul 17 '13 at 22:23
    
Yes Maximus i hade it :P i rewrite the POst i need the Delete.php code xD –  MiRa Benkhar Jul 17 '13 at 23:23
    
Thank's Moch Dear (y) –  MiRa Benkhar Jul 17 '13 at 23:23

2 Answers 2

  DELETE FROM `table` WHERE `some_row`='row_value'

This is the best i can do, since you haven't given enought informations to help you more

share|improve this answer
    
THank's alot ahmad albayati i will see what i do with your solution , and thank's again =) –  MiRa Benkhar Jul 17 '13 at 23:20
if(isset($_POST['delete'])){
//INSERT CODE HERE TO CONNECT TO DATABASE
//DO MORE ERROR CHECKING NECESSARY
mysql_query("DELETE FROM `table` WHERE row='value' LIMIT 1");
//OR YOU CAN USE MYSQLI
$mysqli->query("DELETE FROM `table` WHERE row='value' LIMIT 1");
mysql_close(); 
//MYSQLI AGAIN
mysqli_close();

exit();
}

I can't give you anymore since your question was so broad. Try using PHP.NET for more info.

share|improve this answer
    
Thank's to all , Im soo bad in english , i have the fresh prononsation , i will rewrite the post to clear the idea of the problem , i have a feeling that all friend's here want to help me , and im great and happy to be here –  MiRa Benkhar Jul 17 '13 at 23:06

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.