sql statement
Posted: Sun Apr 23, 2006 11:09 am
Jcart | Please use 
Jcart | Please use
Code: Select all
andCode: Select all
tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Hi, I have a problem, For some reason, the below code doesnt work properly. When i enter something that is equal to o, i get an message "The user has been deleted" but nothing is deleted from my database. Is my query wrong? Can someone please help me?
CheersCode: Select all
<?
$password="";
$user = "";
$database="";
$User_Name=$_POST['User_Name'];
if ($User_Name == null)
{
print(" Please enter your First Name<BR>");
print("Please press the Browser Back button and fill the above mentioned field.");
}
else
{
mysql_connect(localhost,$user,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query = "SELECT * from user_master where USER_NAME='$User_Name'";
$result=mysql_query($query);
$num=mysql_numrows($result);
if ($num>0)
{
$query = "Delete from user_master where (user_name = '$User_Name') && (user_type == 'o')";
mysql_query($query);
mysql_close();
echo " The User: $User_Name has been deleted";
}
else
{
echo "Sorry, that username doesnt exist<BR>";
echo "Please press the Browser Back button and fill the above mentioned field.";
}
}
?>Jcart | Please use
Code: Select all
andCode: Select all
tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]