08-08-2008, 09:34 AM
|
#5 (permalink)
|
|
is cute and cuddly
Join Date: Mar 2008
Location: Vegas, Baby
Posts: 963
Thanks: 31
|
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']; }
|
|
|
|