Dusaro Posted August 31, 2011 Share Posted August 31, 2011 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 https://forums.phpfreaks.com/topic/246084-remove-from-database/ Share on other sites More sharing options...
voip03 Posted August 31, 2011 Share Posted August 31, 2011 Value is id , Not name Link to comment https://forums.phpfreaks.com/topic/246084-remove-from-database/#findComment-1263806 Share on other sites More sharing options...
Dusaro Posted August 31, 2011 Author Share Posted August 31, 2011 Thanks, I didn't notice that Link to comment https://forums.phpfreaks.com/topic/246084-remove-from-database/#findComment-1263807 Share on other sites More sharing options...
voip03 Posted August 31, 2011 Share Posted August 31, 2011 marke it solved. thank you. Link to comment https://forums.phpfreaks.com/topic/246084-remove-from-database/#findComment-1263812 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.