Posts from previous Beta sessions
by Gaxme » Sat Feb 09, 2008 12:17 am
Here are two additional functions for fetching items and a single item associated with a member from the item class.
- Code: Select all
/**
* Fetches passed itemID from the database. First Match is used.
*
* @param unknown_type $item_id
* @param unknown_type $parse_mode
* @return unknown
*/
function fetchItemID( $item_id, $parse_mode=false )
{
global $roster;
$name = $roster->db->escape( $item_id );
$sql = " SELECT *"
. " FROM `" . $roster->db->table('items') . "`"
. " WHERE `item_id` = '$item_id'"
. " LIMIT 1";
$result = $roster->db->query( $sql );
$data = $roster->db->fetch( $result );
if( $data )
{
return new item( $data, $parse_mode );
}
else
{
return false;
}
}
/**
* Fetches passed item itemID with associated member_id from the database.
*
* @param unknown_type $member_id
* @param unknown_type $item_id
* @param unknown_type $parse_mode
* @return unknown
*/
function fetchOneMemberItemID( $member_id, $item_id, $parse_mode=false )
{
global $roster;
$slot = $roster->db->escape( $item_id );
$query = " SELECT *"
. " FROM `" . $roster->db->table('items') . "`"
. " WHERE `member_id` = '$member_id'"
. " AND `item_id` = '$item_id'";
$result = $roster->db->query( $query );
$data = $roster->db->fetch( $result );
if( $data )
{
return new item( $data, $parse_mode );
}
else
{
return null;
}
}
-
Gaxme
- Roster AddOn Dev
-
- Posts: 74
- Joined: Mon Jul 10, 2006 3:54 am
Return to Archived
Who is online
Users browsing this forum: No registered users and 0 guests