Databases Reference
In-Depth Information
Example 3-29 Database class: addMember method
public function addMember($xmlid, $email, $passwd, $fname, $lname)
{
$row = array (
'xmlid'=> $xmlid,
'email' => $email,
'passwd' => $passwd,
'fname'=> $fname,
'lname'=> $lname
);
$table = 'member';
// insert the row and get the row ID
$rows_affected = $this → _db → insert($table, $row);
}
saveNew()
This method inserts a new XML record into XMLDATA , using XCS's
convenience method insert(). Example 3-30 shows the saveNew() function.
Example 3-30 Database class: Insert profile
public function saveNew($entry)
{
return $this → _db1 → insert($entry);
}
getProfile()
This method uses XCS's convenience method findById() that takes docid as
input and returns the XML record as an array. Example 3-31 shows the
getProfile() function.
Example 3-31 Database class: Retrieve profile
public function getProfile($xmlid)
{
$result = $this → _db1 → findById($xmlid);
if(!is_null($result)) {
return $result;
}
return false;
}
The Add Contact/relationship feature allows a member to make contacts with
other members and create the chain of professional relationships. The user
Search WWH ::




Custom Search