View Single Post
Old 08-08-2008, 09:34 AM   #5 (permalink)
delayedinsanity
is cute and cuddly
 
delayedinsanity's Avatar
 
Join Date: Mar 2008
Location: Vegas, Baby
Posts: 963
Thanks: 31
delayedinsanity is on a distinguished road
Default

It's the echo. When you try and use string concatenation on a function that echo's a value, instead of returning it, the value will appear before the string in which it's been included.

Try this:

PHP Code:
    function getUsersName()
    { 
     
        
// In addition, since you're only using the name column from your
        // query, it's more efficient to just select that column instead of *
        
$q sprintf("SELECT name FROM `tbl_users` WHERE `email` = '%s' LIMIT 1"mysql_real_escape_string($_SESSION['myemail']));
        
$result mysql_query($q) or trigger_error(mysql_error()); 
         
        
$row mysql_fetch_assoc($result);
         
        return 
$row['name']; 
     
    } 
delayedinsanity is offline  
Reply With Quote
The Following 2 Users Say Thank You to delayedinsanity For This Useful Post:
boycoda (08-08-2008), Scottymeuk (01-06-2009)