Surprise! We've been running on hardware provided by BuyVM for a few months and wanted to show them a little appreciation.
Running a paste site comes with unique challenges, ones that aren't always obvious and hard to control. As such, BuyVM offered us a home where we could worry less about the hosting side of things and focus on maintaining a clean and useful service! Go check them out and show them some love!
Submitted on August 12, 2015 at 12:47 PM

Section 1 (Text)

<?php
 
        error_reporting(-1);
        ini_set('display_errors', 'On');
 
       
        $servername = "xxxx";
        $username = "xxx";
        $password = "xxx";
        $dbname = "xxxx";
 
        try {
                $dbh = new PDO("mysql:host=$servername;dbname=$dbname", $username, $password);
                // set the PDO error mode to exception
                $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
        } catch(PDOException $e) {
                echo "Connection failed: " . $e->getMessage();
        }
       
       
        if(!empty($_GET["delete_id"])) {
			$id = $_GET['delete_id'];
			$sql = "DELETE FROM tagesroma WHERE id=:id";
			$stmt = $dbh->prepare($sql);
			$stmt->bindParam(':id', $id, PDO::PARAM_INT);
			$stmt->execute();
			echo $stmt->rowCount() . " rows deleted<br>"; 
        }
?>     
<!DOCTYPE html>
<html>
 
        <head>
                <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
                <title>Delete Record from table Tagesroma</title>
               
                <script type="text/javascript">
                        function delete_id(id)
                        {
                         if(confirm('Sure To Remove This Record ?'))
                         {
                          window.location.href='delete.php?delete_id='+id;
                         }
                        }
                </script>
               
        </head>
       
        <body>
       
                <center>
 
                        <div id="header">
                                <div id="content">
                                        <label>Delete Record from table Tagesroma</label>
                                </div>
                        </div>
                       
                        <div id="body">
                                <div id="content">
                                        <table align="center">
                                        <?php
                                       
                                                $stmt = $dbh->prepare("SELECT * FROM tagesroma");
												$stmt->execute();
                                                $data = $stmt->fetchAll();
                                               
                                                if(count($data) > 0) {
                                               
                                                        foreach($data as $row) {
                                                                echo '<tr>';
                                                                        echo "<td>" . $row['nome'] . "</td>";
                                                                        echo "<td>" . $row['cognome'] . "</td>";
                                                                        echo "<td>" . $row['indirizzo'] . "</td>";
                                                                        echo "<td>" . $row['civico'] . "</td>";
                                                                        echo "<td>" . $row['citta'] . "</td>";
                                                                        echo "<td>" . $row['prov'] . "</td>";
                                                                        echo "<a href='javascript:delete_id(" . $row["id"] . ")'>Delete this row</a>";
                                                                echo '</tr>';
                                                        }
                                                       
                                                } else {
                                                        echo "There's No data found !";
                                                }
                                               
                                        ?>
                                        </table>
 
                                </div>
                        </div>
                       
                </center>
            <a title="Torna indietro" href="admin.php">Torna Indietro</a>   
        </body>
</html>