twilitegxa Posted September 8, 2011 Share Posted September 8, 2011 I'm having trouble getting my records deleted from my table. Here is part of the admin page (the delete code I'm trying to use starts around line 1050): <td style="border:0px; text-align:center"><a href="?p=deletemember&user=<?=$id?>"><img src="images/icon_delete.png" style="border:0px" /></a></td> </tr> <? } } ?> </table> <? } if($p=='deletemember'){ $sql = "DELETE FROM `carers` WHERE `id`='".$_GET['user']."'"; mysql_query($sql); echo "<p class='fyi'>The selected carer has been deleted.</p>"; } if($p=='editmember'){ if($_POST['update2']){ $type = join(",", $_POST['type']); $sql="UPDATE `carers` SET `photo`='".$_POST['photo']."', `type`='".$type."', `availability`='".$_POST['availability']."', `experience`='".$_POST['experience']."', `qualifications`='".$_POST['qualifications']."', `description`='".$_POST['description']."', `active`='".$_POST['active']."' WHERE `uid`='".$_GET['user']."'"; mysql_query($sql); $sql="UPDATE `users` SET `email`='".$_POST['email']."', `phone`='".$_POST['phone']."', `firstname`='".$_POST['firstname']."', `lastname`='".$_POST['lastname']."', `location`='".$_POST['location']."' WHERE `id`='".$_GET['user']."'"; mysql_query($sql); echo "<p class='fyi'>Your information has been updated</p>"; } if($_POST['update']){ $sql="UPDATE `users` SET `email`='".$_POST['email']."', `phone`='".$_POST['phone']."', `firstname`='".$_POST['firstname']."', `lastname`='".$_POST['lastname']."', `location`='".$_POST['location']."' WHERE `id`='".$_GET['user']."'"; mysql_query($sql); echo "<p class='fyi'>Your information has been updated</p>"; } Please, can anyone tell me what I'm doing wrong and how to fix it? What other information would you need to answer my question? I couldn't fit the entire admin page because it exceeded the limit on there, but please let me know if you need to see more to help me. I have left an example of how the edit code works to see if that helps. Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted September 8, 2011 Share Posted September 8, 2011 So, is the column in that table actually named: uid? What does mysql_error() tell you as to why the query is failing? Quote Link to comment Share on other sites More sharing options...
twilitegxa Posted September 8, 2011 Author Share Posted September 8, 2011 Oh! I just figured it out! The table was users, and not carers, so now it works! Thank you for your help! You pointed me in the right direction with your questions! Thank you so much! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.