Forum Moderators: coopster
<?php
// First we establish a MySQL connection...
include 'config/db.inc.php';
// Then we fetch the table data from the database...
$result = mysql_query("select * from users");
// A few variables need to be declared...
while($r=mysql_fetch_array($result))
{
$id=$r["id"];
$email=$r["email"];
$quota=$r["quota"];
// Now we can display the table...
echo "<tr>";
echo "<td>";
echo "$id";
echo "</td>";
echo "<td>";
echo "$email";
echo "</td>";
echo "<td>";
echo "$quota kb";
echo "</td>";
echo "<td>";
echo "<form method=\"post\" action=\"includes/scripts/user_delete.php\"><input name=\"userdel\" type=\"hidden\" value=\"$id\"><input type=\"image\" src=\"images/delete.png\"></form>";
echo "</td>";
echo "</tr>";
}
I have used a form, and the script it points to is this..
<?php
include '../../config/db.inc.php';
$result = mysql_query("select * from users");
// A few variables need to be declared...
while($r=mysql_fetch_array($result))
{
$id=$r["id"];
$email=$r["email"];
$password=$r["password"];
$quota=$r["quota"];
}
if (isset($_POST['userdel'])){
$userdel = mysql_query("DELETE FROM users WHERE id='$id'");
$_SERVER['PHP_SELF'];
Any idea's how I can get it working? It seems to always delete the bottom record.
The page looks like this..
<snip>
Thanks in advance.
[edited by: ShadyB at 7:22 pm (utc) on Feb. 25, 2008]
[edited by: dreamcatcher at 8:31 pm (utc) on Feb. 25, 2008]
[edit reason] no urls as per T.O.S [webmasterworld.com].Thanks [/edit]