Location: PHPKode > projects > PHP MySQL Address Book > addressbook/library/deluser.php
<?php
if(! isset($_SESSION['sectors']))
{
				session_start();
			
			  include 'config.php';
			//    $dbConf = new AAConf();
				$databaseURL =$dbhost;
				$databaseUName = $dbuser;
				$databasePWord = $dbpass;
				$databaseName = $dbname;
				 
			
				$connection = mysql_connect($databaseURL,$databaseUName,$databasePWord);
				if (!$connection)
					  {
					  die('Could not connect: ' . mysql_error());
					  }
					// or die ("Error while connecting to localhost");
				$db = mysql_select_db($databaseName,$connection);
					//or die ("Error while connecting to database");
			
			
			 	if (trim($_GET['ID'])!="")
					 {
								$q="SELECT `user_id` FROM `contacts` WHERE `user_id` =".$_GET['ID']." OR `user_id2` =".$_GET['ID'];
								mysql_query("SET NAMES 'utf8'");
								mysql_query('SET CHARACTER SET utf8'); 
								$r = mysql_query($q);
								if (mysql_num_rows($r) > 0)
								{
									mysql_close($connection);
									echo "records found";
									header('Location:../addedituser.php?ID='.$_GET['ID'].'&mod=d');
								}
								else
								{
										$sql="delete from `cal_accounts` WHERE `id`=". $_GET['ID'];
										mysql_query("SET NAMES 'utf8'");
										mysql_query('SET CHARACTER SET utf8'); 
										echo "records not found can delete";
										if (!mysql_query($sql,$connection))
												  {
												  die('Error: ' . mysql_error());
												  }
	    					  						mysql_close($connection);
												  header('Location: ../usrmanagmnt.php');
								  }

						
						
					
					}



}

?>
Return current item: PHP MySQL Address Book