This topic is locked

first name and surname of the logged user

5/29/2007 6:23:28 PM
PHPRunner General questions
L
lucian author

I want to find first name and surname of the logged user which are stored in "fullname" field from the table "users" when a new record is added and insert this data in a field "author".

My function looks like this:
function BeforeAdd(&$values)

{
global $conn;
$strSQL = "select fullname from users where uname = '".$_SESSION["UserID"]."'";

$auth=db_query($strSQL,$conn);

$values["author"]=$auth;
return true;
}

I don't receive errors but the value inserted in "author" is "Resource id #13".
Can anyone help me?

L
lucian author 5/30/2007

It works in this way:
function BeforeAdd(&$values)

{
global $conn;

$values["user"]= $_SESSION["UserID"];

$strSQL = "select fullname from users where uname = '".$values["user"]."'";

$auth=db_query($strSQL,$conn);

$data = db_fetch_array($auth);

$values["author"]=$data["fullname"];

return true;
}

I want to find first name and surname of the logged user which are stored in "fullname" field from the table "users" when a new record is added and insert this data in a field "author".

My function looks like this:
function BeforeAdd(&$values)

{
global $conn;
$strSQL = "select fullname from users where uname = '".$_SESSION["UserID"]."'";

$auth=db_query($strSQL,$conn);

$values["author"]=$auth;
return true;
}

I don't receive errors but the value inserted in "author" is "Resource id #13".
Can anyone help me?