Hi all,
New to this forum, so to start 'A big hello to you all'.
My question:
I have a drop down menu that is created from the username in my database but is distinct:
<td><class="tdText"><strong><?php echo $lang['admin']['adminusers']['show_emptysessions'];?></strong></td>
<td align="right">
<?
$query= mysql_query("SELECT DISTINCT username FROM CubeCart_admin_sessions");
echo "<form action=removebyname.php method=POST><select name=users>";
while ($r = mysql_fetch_array($query))
{
$user = $r["username"];
echo "<option value=$user>$user</option>";
}
echo "</select>";
?>
<INPUT TYPE=submit NAME=users VALUE="Go!">
</form>
Then my removebyname.php file:
mysql_connect($glob['dbhost'],$glob['dbusername'],$glob['dbpassword']);
@mysql_select_db($glob['dbdatabase']) or die( "Unable to select database");
// DETERMINE WHICH RECORDS TO DELETE
$query="SELECT loginid FROM CubeCart_admin_sessions WHERE username='$user'";
mysql_query($query);
//SHOW WHICH RECORDS TO DELETE
$query="SELECT * FROM CubeCart_admin_sessions WHERE loginid='$user'";
mysql_query($query);
//DELETE CHOSEN USER RECORD
$query="DELETE FROM CubeCart_admin_sessions WHERE loginid='$user'";
mysql_query($query);
//DELETE THE ID COLUMN
$query="ALTER TABLE CubeCart_admin_sessions DROP COLUMN loginId";
mysql_query($query);
//RECREATE THE ID COLUMN STARTING FROM ONE
$query="ALTER TABLE CubeCart_admin_sessions ADD COLUMN loginId INT NOT NULL AUTO_INCREMENT PRIMARY KEY";
mysql_query($query);
//PRINT SUCCESS STATEMENT TO SCREEN
echo "All records relating to $user have been purged successfully";
mysql_close();
?>
<META HTTP-EQUIV="refresh" content="0;URL=sessions.php">
The distinct drop down works fine in my session.php file and locates the removebyname.php file but just prints the success message (minus the varaible i set) returns to the session.php but nothing is deleted.
Any ideas my friends ??????
And thanks for reading.
Jon