1,080,617 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?

Posts by KPheasey Contributing to Articles being Marked Solved

Try this:

session_start();  
 
if (!isset($_SESSION['memberusername'])){  
	header("location:contractorlogin.php");  
	exit();  
}
 
$user = $_SESSION['memberusername'];
$sql = "SELECT Username FROM contractors WHERE Username LIKE'" . $user . "'";
$query = mysql_query($sql);
$row = mysql_fetch_array($query);

echo $row['username'];

if there are multiple rows being returned try this:

session_start();  
 
if (!isset($_SESSION['memberusername'])){  
	header("location:contractorlogin.php");  
	exit();  
}
 
$user = $_SESSION['memberusername'];
$sql = "SELECT Username FROM contractors WHERE Username LIKE'" . $user . "'";
$query = mysql_query($sql);
while($row = mysql_fetch_array($query)){
     echo $row['username'];
}

Also if Username is unique don't use like use =

KPheasey
Newbie Poster
16 posts since May 2010
Reputation Points: 10
Solved Threads: 2
Skill Endorsements: 0

Insert the following code right before echo "Thank you......

$to = "youremail@somewhere.com" //Your email address
$subject = "New Entry"; //Email subject
$message = "new details have been entered into the database" //Body of email
mail($to, $subject, $message);

Check http://php.net/manual/en/function.mail.php for complete info on the mail() function.

KPheasey
Newbie Poster
16 posts since May 2010
Reputation Points: 10
Solved Threads: 2
Skill Endorsements: 0
 
© 2013 DaniWeb® LLC
Page generated in 0.0379 seconds using 2.47MB