Jump to content

remove from database


Dusaro

Recommended Posts

This is probably very obvious but i gots stuck.

I want to to display a list of the members then you select the member and it deletes the member.

I do not get a message saying it failed, it just doesn't delete the member.

 

Removemember.php:

<form action='removemember_complete.php' method='POST'>

<label>Name:</label>
<select name="memberid">
<?php
$con = mysql_connect("localhost","slay2day_User","slay2day");
if (!$con)
{
	die('Could not connect: ' . mysql_error());
}
mysql_select_db("slay2day_database",$con);
$sqlquery="SELECT * FROM `members` Order By name";
$result=mysql_query($sqlquery,$con);
while($row=mysql_fetch_array($result))
{
	echo "<option value='".$row['id']."'>".$row['name']."</option>";
}
?>
</select>
<br>

<input type="submit" value="Remove" />
</form>

 

removemember_complete.php:

<?php
$name=$_POST['name'];

$con = mysql_connect("localhost","slay2day_User","slay2day");
if (!$con)
{
	die('Could not connect: ' . mysql_error());
}
mysql_select_db("slay2day_database",$con);

$sql="DELETE FROM members WHERE name = '$name'";
if(mysql_query($sql,$con))
{
	echo 'Member Removed.<br /><a href="../index.php">Return To Points List</a><br /><a href="removemember.php">Remove More Members</a>';
}
else
{
	die('Could not submit: ' . mysql_error());
}
mysql_close($con);

?>

 

Thanks in advance.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.