Jump to content

DELETE FROM problem


unistake

Recommended Posts

Hi all,

 

I have been trying to create a very simple php script to delete a users account however it doesnt appear to be that simple!

 

The $_SESSION[logname] is correct as it echos when asked for.

 

<?php 
session_start();
if (@$_SESSION['auth']!="yes") 
{ 
	header("Location:signin-redirect.php?page=my-account.php"); 
} 
else 
{
include("../cxnconnection.php");

mysql_query("DROP FROM Members WHERE email='$_SESSION[logname]'")
or die ("Cant delete Member where email is $_SESSION[logname]"); 

session_destroy();
unset($_SESSION);

header("Location:../index.html");

}

?>

 

Thanks for your help

Link to comment
https://forums.phpfreaks.com/topic/208330-delete-from-problem/
Share on other sites

Thanks for your reply Mchl,

 

I have just changed the above script from

mysql_query("DROP FROM Members WHERE email='$_SESSION[logname]'")  to

mysql_query("DELETE FROM Members WHERE email='$_SESSION[logname]'")

 

I believe this is right but it is not working, do you know whats up with it?

 

Link to comment
https://forums.phpfreaks.com/topic/208330-delete-from-problem/#findComment-1088785
Share on other sites

Still not working, my full code now is...

 

<?php 
session_start();
if (@$_SESSION['auth']!="yes") 
{ 
	header("Location:signin-redirect.php?page=my-account.php"); 
} 
else 
{
include("../cxnconnection.php");

mysql_query("DELETE FROM Members WHERE email='".$_SESSION['logname']."'")
or die ("Cant delete Member where email is $_SESSION[logname]"); 

session_destroy();
unset($_SESSION);

header("Location:../index.html");

}

?>

Link to comment
https://forums.phpfreaks.com/topic/208330-delete-from-problem/#findComment-1089134
Share on other sites

You probably introduced a fatal parse error when you added the code incorrectly.

 

Are you developing and debugging your code on a system with error_reporting set to E_ALL and display_errors set to ON in your master php.ini so that all the errors php detects will be reported and displayed? You will save a ton of time.

Link to comment
https://forums.phpfreaks.com/topic/208330-delete-from-problem/#findComment-1089255
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.