monarch_684
07-05-2007, 09:42 AM
This is what I have:
<?php
$id = $_POST["id"];
$query = "DELETE FROM information WHERE id = '{$id}' ";
$connection = mysql_connect("localhost", "username", "password");
@mysql_select_db("info_scroller", $connection)
or die( "Unable to select database" . mysql_error());
$result = mysql_query($query)
or die ("Couldn't query data" . mysql_error());
mysql_close();
?>
I am linking this from a delete link on a display screen:
<?php
$connection = mysql_connect("localhost", "username", "password");
@mysql_select_db("info_scroller", $connection)
or die( "Unable to select database" . mysql_error());
$query = "SELECT * FROM information";
$result = mysql_query($query)
or die ("Couldn't query data" . mysql_error());
echo "<table border='1'>";
echo "<tr>";
echo "<th>ID</th><th>Info</th><th>Submitted By</th>";
echo "</tr>";
while ($row = mysql_fetch_array($result)) {
echo "<tr>";
echo "<td name=\"id\">", $row['id'], "</td><td>", $row['info'],"</td><td>", $row['submit_by'], "</td><td><a href='delete.php'>delete</a> | edit</td>";
echo "</tr>";
}
echo "</table>";
mysql_close();
?>
For some reason this is not deleting the data. Any ideas?
<?php
$id = $_POST["id"];
$query = "DELETE FROM information WHERE id = '{$id}' ";
$connection = mysql_connect("localhost", "username", "password");
@mysql_select_db("info_scroller", $connection)
or die( "Unable to select database" . mysql_error());
$result = mysql_query($query)
or die ("Couldn't query data" . mysql_error());
mysql_close();
?>
I am linking this from a delete link on a display screen:
<?php
$connection = mysql_connect("localhost", "username", "password");
@mysql_select_db("info_scroller", $connection)
or die( "Unable to select database" . mysql_error());
$query = "SELECT * FROM information";
$result = mysql_query($query)
or die ("Couldn't query data" . mysql_error());
echo "<table border='1'>";
echo "<tr>";
echo "<th>ID</th><th>Info</th><th>Submitted By</th>";
echo "</tr>";
while ($row = mysql_fetch_array($result)) {
echo "<tr>";
echo "<td name=\"id\">", $row['id'], "</td><td>", $row['info'],"</td><td>", $row['submit_by'], "</td><td><a href='delete.php'>delete</a> | edit</td>";
echo "</tr>";
}
echo "</table>";
mysql_close();
?>
For some reason this is not deleting the data. Any ideas?