i have a little issue with this function
Posted: Thu Jan 24, 2008 11:28 pm
i made this function which is supposed to get the person's name from the database and make a username
but its not returning anything, blank, zip, none and there are also no errors
Can someone please tell me what I did wrong ? And yes, $thisRecord does contain a value
Code: Select all
$getUserNameQuery_string = "SELECT * FROM phil_clientes WHERE phil_clientes.id = '{$thisRecord}'";
$getUserNameQuery = mysql_query($getUserNameQuery_string) or die(mysql_error());
function makeUserName(){
while($row = mysql_fetch_assoc($getUserNameQuery)){
$cn = $row['name'];
$cn = strtolower($cn);
if(strpos(" ") !== FALSE){// space
$s = explode(" ", $cn);
$d = $s[0];
}else if(strpos(",") !== FALSE){//comma
$s = explode(",", $cn);
$d = $s[0];
}else if(strpos(".") !== FALSE){//dot
$s = explode(".", $cn);
$d = $s[0];
}else{
$d = $cn;
}
}
echo $d;
return $d;
}Can someone please tell me what I did wrong ? And yes, $thisRecord does contain a value