Stevo
08-16-2004, 12:39 PM
Alright I have this script and I want to add a delete feature to it. The table has a username and password for each record and I want to delete the record using the username as the ID. Is this possible? If so, how?
Here's the script:
<?php
$db = mysql_connect($host, $dbuname, $dbpass);
mysql_select_db($dbname,$db);
echo "<table>";
echo "<tr>";
echo "<td><strong>Username:</strong></td>";
echo "<td><strong>Password:</strong></td>";
echo "<td><strong>Delete</strong></td>";
echo "</tr>";
$result = mysql_query("SELECT * FROM users ORDER BY username ASC",$db);
while ($myrow = mysql_fetch_array($result)) {
$username = $myrow["username"];
$password = $myrow["password"];
echo "<tr>";
echo "<td>$username</td><td>$password</td><td>Delete</td>";
echo "</tr>";
}
echo "</table>\n";
?>
Help would be appreciated.:)
Here's the script:
<?php
$db = mysql_connect($host, $dbuname, $dbpass);
mysql_select_db($dbname,$db);
echo "<table>";
echo "<tr>";
echo "<td><strong>Username:</strong></td>";
echo "<td><strong>Password:</strong></td>";
echo "<td><strong>Delete</strong></td>";
echo "</tr>";
$result = mysql_query("SELECT * FROM users ORDER BY username ASC",$db);
while ($myrow = mysql_fetch_array($result)) {
$username = $myrow["username"];
$password = $myrow["password"];
echo "<tr>";
echo "<td>$username</td><td>$password</td><td>Delete</td>";
echo "</tr>";
}
echo "</table>\n";
?>
Help would be appreciated.:)